I've been searching the most simple and elegant solution and found this:
#include <iostream>
#include <utility>
#include <tuple>
struct A{
void hi(){
std::cout << "HI\n";
}
};
template<typename Tuple, std::size_t... Is>
void unpack(Tuple& tpl, std::index_sequence<Is...>){
((std::get<Is>(tpl).hi()),...);
}
int main(){
std::tuple<A,A,A,A,A,A> tpl { A(), A(), A(), A(), A(), A() };
unpack(tpl, std::make_index_sequence<6>{});
return 0;
}
However, i do not completely understand this line:
((std::get<Is>(tpl).hi()),...);
I understand what it does, but what is that kind of syntax?
Is it somewhere in standard?