diff --git a/ffi/include/tvm/ffi/base_details.h b/ffi/include/tvm/ffi/base_details.h index 6b0dee462e8c..fb7be1a955ba 100644 --- a/ffi/include/tvm/ffi/base_details.h +++ b/ffi/include/tvm/ffi/base_details.h @@ -136,23 +136,16 @@ namespace ffi { namespace details { // for each iterator -template struct for_each_dispatcher { - template - static void run(const F& f, T&& value, Args&&... args) { // NOLINT(*) - f(I, std::forward(value)); - for_each_dispatcher::run(f, std::forward(args)...); + template + static void run(std::index_sequence, const F& f, Args&&... args) { // NOLINT(*) + (f(I, std::forward(args)), ...); } }; -template -struct for_each_dispatcher { - static void run(const F&) {} // NOLINT(*) -}; - template void for_each(const F& f, Args&&... args) { // NOLINT(*) - for_each_dispatcher::run(f, std::forward(args)...); + for_each_dispatcher::run(std::index_sequence_for{}, f, std::forward(args)...); } /*!