jeudi 20 octobre 2016

unzip a list of tuples

Any idea about how to implement this function_

template <class ... Ts> 
auto unzip(const list<tuple<Ts...>> & l)
{
  ...
}

This function would receive a list of tuples and would return a tuple of lists. The first list would contain the elements of get<0>(t), and so on.

I can traverse the items of a tuple and of course traverse the list. But I don't know how declare some such tuple<list<T1>, list<T2> ...>

Any clue or reference?

Aucun commentaire:

Enregistrer un commentaire