c++ - Dynamically construct tuple from vector -
this question has answer here:
- c++ : convert vector tuple 3 answers
i've got interesting problem need dynamically create tuple vector number of type parameters of tuple equals length of vector.
vector<int> v1 = {1,2,3}; tuple<int, int, int> t1 = create_tuple(v1); vector<int> v2 = {1,2}; tuple<int, int> t2 = create_tuple(v2); vector<int> v3 = {1}; tuple<int> t3 = create_tuple(v3);
i'm guessing can done, if possible, @ compile time?
of course can done @ compile-time: "members" of tuple baked type.
Comments
Post a Comment