c++ - Non-type template parameter for polymorphic lambda? -
is possible write this?
[](std::index_sequence<std::size_t ...i> s) { };
or this?
[]<std::size_t ...i>(std::index_sequence<i...> s) { }
how syntax in c++14 or c++17? or not possible @ all? basically, want have i
template parameter pack, , lambda serves way that. alternatively, there syntax achieve following?
std::index_sequence<std::size_t ...i> x = std::make_index_sequence<10>{}; // local template parameter pack
gcc provides latter syntax as extension, it's not standard:
template <typename... ts> void foo(const std::tuple<ts...>& t) { auto l = [&t]<std::size_t ...i>(std::index_sequence<i...> s) { std::initializer_list<int>{ (std::cout << std::get<i>(t), 0)... }; }; l(std::index_sequence_for<ts...>{}); }
Comments
Post a Comment