Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7510233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:10:03+00:00 2026-05-29T23:10:03+00:00

For code such as this: std::list<int> a[3][3]; int myNumber = 0; for(int i =

  • 0

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:

enter image description here

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:10:05+00:00Added an answer on May 29, 2026 at 11:10 pm

    “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 your list<int> at a[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:

    std::list<int> l[2];
    l[1].push_back(3);
    l[1].push_back(4);
    

    then variable l is considered pointer to first std::list<int> so even if you push elements into list at index 1, Visual Studio just shows you that l is empty list: some address [0](). I can see l[1] only if its in Watch:
    enter image description here

    Possible solution is to replace simple c-style array ([]) with std::vector :

    std::vector<std::list<int> > l;
    l.resize(2);
    
    l[1].push_back(3);
    l[1].push_back(4);
    

    so l is not considered a pointer to first list anymore. Since l is vector Visual Studio displays you all elements properly:
    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is such code: #include <iostream> int main() { int size; std::cin >> size;
There is such code: #include <cstdlib> #include <clang-c/Index.h> using namespace std; int main(int argc,
Considering this code: std::vector<myObject*> veryLargeArray; for (int i = 0; i < veryLargeArray.size(); ++i)
There is such code: #include <iostream> class A{ public: friend void fun(A a){std::cout <<
There is such code: #include <iostream> int main() { int a; int* p =
There is such code: #include <iostream> class A { public: int a; A() :
I would select multiple DOM elements using a typical code such as this: $('#ele1,
While striving for const-correctness, I often find myself writing code such as this class
I have written this code to convert string in such format 0(532) 222 22
Can anyone beat the performance of my integer to std::string code, linked below? There

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.