Reputation: 105
I need a dynamic list of integer arrays.
I would think that it could be declared as:
list<int[10]> myListOfArrays;
But this doesn't work, and the compiler returns the errors:
error: 'std::_list_node<_Tp>::_M_data' has incomplete type
error: invalid use of array with unspecified bounds
Is there a way to do this?
The size of the integer arrays need not be dynamic, only the number of lists.
Upvotes: 0
Views: 3975
Reputation: 164
list<int*> myListOfArrays;
will work, particularly as you are happy with the arrays of ints having a static size.
Something like:
std::list<int*> listOfArrays;
int[10] intArray;
listOfArrays.push_back(intArray);
What you are really doing is storing int pointers in your list.
Upvotes: 0