I'm Michael (the initial author) now having ID La-AIDA
Firstly, thank you all, Boost & Fusion where new to me.
To Éric:
One Typo: v[1] should have N_1 entries, v[2] N_2 and so forth.
I would like STL-like stuff, not C-arrays (lacking bounds check with no option to add it).
New comment to Éric:
I tried your solution, it worked (almost, after removing the dummy query) immediately!
Thank you!
But: I need something like
for (i = 1;i < 30;i++) {
cout << s.At<i>[0] << endl;
}
that is, the index for At<..> should be variable (that is the whole point, to be able to run an index instead of treating 30 hard-coded things separately)
but gcc complains with error: 'i' cannot appear in a constant-expression
About the "as in Java":
AfaIk, a two-dim matrix in Java is not some
int v[10][10];
with fixed dimensions, but something like
int[][] v;
where you first have a
v = new int[10][];
(or similar syntax) and then, and this is the point:
v[0] = new int[1];
...
v[9] = new a[10];
which makes a triangular matrix, or of course any form you like.
In fact a regular 10-by-10 matrix as well requires 1 plus 10 new's.
About the structure itself:
An equivalent data structure would be
vector<int> v1;
vector<pair<int,int>> v2;
vector<int,int,int> v3;
...
vector<int[29]> v29;
where however we would have to address each of the 30 parts separately.
I would like to be able to say v[5][3][123] = 99;
to set the 3rd component in the 123rd 5-tuple to 99, without defining
vector<int> v[30][30];
which would do the trick, but wasting enormous space, since
v[1][2..30][0..\infty] or more generally v[i][i+1..30][*]
are never used.
So, in my problem, I have a list of int's , another of pairs, of triples,..., of 30-tuples of int's, which all should be sortable etc., within a single structure, without wasting space.