Thanks Athar and R0mai, but now that I think about it a bit more, I think my original question runs deeper than I had originally anticipated.
Aside from my original situation, I'd like to know if
any array of different sized containers is even possible to use at all, dynamic or static.
For example, if this code is used to create such an array:
1 2 3 4 5 6 7 8
|
set<int> set_array[10];
for (int i=0; i<10; i++) {
set_array[i] = createRandomSizedSet(someVariable);
}
|
will the system (or even the compiler) be able to handle the following task, without getting mixed up?
1 2 3 4 5 6
|
for (int j=0; j<10; j++) {
outputSet(set_array[j]);
}
|
It looks simple, but think about it--the sets are of different sizes.
I was taught that arrays are contiguous blocks of memory pointed to by the array name. But if the blocks are of different sizes, how would the system know where one block begins and another one ends?
And what would then happen if one or more of the sets in the array was enlarged or made smaller by the addition or removal of some of its elements? How would the system keep track of the "boundaries" between the sets in memory?
I would really like to understand this, so thanks to anyone who can help.
Thanks again.