I want to have a tuple of vectors, something like {1,2,3,4},{5,6},{7,8,9}. The reason I need this, is I know a priori how many vectors I need, but not how long they'll be. So I thought this might be the best way to do this. Also in the end I want to save them to a map, because I need several of these tuples later and so that I can access them by index.
For a start I thought about something like:
#include <vector>
#include <tuple>
#include <iostream>
#include <map>
using namespace std;
typedef vector<int> VECTOR;
typedef tuple<VECTOR, VECTOR, VECTOR> TUPLE;
typedef map<int, TUPLE> MAP;
int main()
{
MAP m;
VECTOR v1, v2, v3;
TUPLE t;
v1 = { 1, 2, 3, 4 };
v2 = { 5, 6 };
v3 = { 7, 8, 9 };
t = make_tuple(v1, v2, v3);
m.insert(pair<int, TUPLE>(1, t));
return 0;
}
How can I print my map and how can I access the tuple in it?
EDIT: I know how to loop through a map, but not how to print a tuple of vectors.