I have a parameter pack args... of vectors of arbitrary types, corresponding to which there is a vector of indices say v = {3,0,5...} having the same size, and order as the number of members of args.... I would like get_tuple to return a tuple of the elements of args... at the indices given by v.
Here's what I have so far, but I'm stuck trying to iterate over the members of the parameter pack.
template<typename... Args> auto get_tuple(const std::vector<size_t>& vector, const Args &... args) { return std::make_tuple(args[v[0]]...); } For example:
std::vector<std::string> v1 = {"a", "b"}; std::vector<int> v2 = {1,2}; std::vector<size_t> v = {0,1}; auto result = get_tuple(v, v1, v2); // ("a",2) expected