I am trying to create a variation container template that stores a set of element vectors. The point of this container is the elements of all vectors, all related, and I want to maintain this correlation later, but this is not necessary for calculation. Imagine, if you want, vector_3 and ref_id of some kind.
The container will only mutate the vectors evenly together. Therefore, the parts that I understand look like this:
template<typename ...Elems>
class container
{
std::tuple<std::vector<Elems>...> data_;
public:
template<typename I>
const typename std::tuple_element<I, data_type>::type &nth_index() const
{ return std::get<I>(data_); }
};
I am struggling with the insertion method. I thought something like:
void push_back(std::tuple<Elems...> &values)
{
std::tuple<std::back_insert_iterator<std::vector<Elems>>...> inserters;
}
But I do not know how to initialize this tuple of "inserters". I looked at various examples of recursive patterns here in stackoverflow, and I can't keep it all in my head long enough to figure it out.
I assumed that if I had such a tuple, I could use a simple assignment:
inserters = values;
, :
std::tuple<Elems &...> operator[](const size_t index)
{
...
}
, , .
, - , , . 0x. . MSVC 2012.