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...>{}); } 

live demo


Comments

Popular posts from this blog

Lists in Python -

android - can not access to progress bar in an other activity -

java - Vaadin 7 Pass Data Between Views -