For code such as this:
std::list<int> a[3][3];
int myNumber = 0;
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 3; j++)
{
a[i][j].push_back(myNumber);
myNumber++;
}
}
The Local window of the debugger shows:

There is no easy way to go through and see that:
list a[ 0 ][ 0 ] contains 0
list a[ 0 ][ 1 ] contains 1
list a[ 0 ][ 2 ] contains 2
list a[ 1 ][ 0 ] contains 3
etc.
I can only see what lists [ 0 ][ 0 ], [ 1 ][ 0 ], and [ 2 ][ 0 ] contain but I want to see what all the lists contain. How do I go about doing this in Visual Studio 2010?
“There is no easy way to go through and see that list
a[0][2]contains 2″You right click somewhere into code, chose Quick Watch, write there
a[0][2]and with Add Watch you put into “Watch 1” so that you can see yourlist<int>ata[0][2]properly.When you declare simple
list<int> l;, Visual Studio shows it properly. You are able to see all elements.But when you declare array of lists like this:
then variable

lis considered pointer to firststd::list<int>so even if you push elements into list at index 1, Visual Studio just shows you thatlis empty list:some address [0](). I can seel[1]only if its in Watch:Possible solution is to replace simple c-style array (
[]) withstd::vector:so

lis not considered a pointer to firstlistanymore. SincelisvectorVisual Studio displays you all elements properly: