jeudi 28 avril 2016

TMP C++ and parameter packs

template<std::size_t... Is>
void unlock_(std::index_sequence<Is...>) {

    iter(std::get<Is>(tuple)...);
}

Let's consider above example. I cannot understand iter(std::get<Is>(tuple)...);. I know that ... is expanding "operator". So it should be applied to parameter pack ( in sense arguments) or template paremeter packs. And I can imagine what is std::index_sequence<Is...>. Because Is is template parameter pack it should be just 1, 2, 3, 4, ... ( for example) . In that case out parameter is specific because it is not type. It is size_t.

But here: std::get<Is>(tuple)...); std::get(tuple) doesn't return parameter/template pack so I cannot context of usage.

P.S. Is it possible to see how the code looks after meta-programming? Similiary to after preprocessing?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire