Debugging the Standard Template Library

This is a discussion on Debugging the Standard Template Library within the C++ Programming forums, part of the General Programming Boards category; I've started using the standard template library recently, but I'm really having difficulty debugging my code. The "watch window" offers ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    9

    Debugging the Standard Template Library

    I've started using the standard template library recently, but I'm really having difficulty debugging my code. The "watch window" offers very little info on the contents of say vector.

    Am I missing something simple? How do I see what it is holding?

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,325
    What IDE are you using? What version?

    Watching a vector or any other complex object is of course more difficult than looking at built-in types, but there are usually tricks you can use to get the information you need.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    9
    Microsoft Visual C++ .NET version 7

  4. #4
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    when you look at the vector in the watch window, you can get the ide to treat it as an array.

    copy the vector from the 'locals' or 'this' window to the watch window. look for the _Myfirst var and add a ', 10' after it. this will tell the ide to treat it as an array of size 10 (insert your own size obviously)
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  2. Abstract Base Class and References
    By Thantos in forum C++ Programming
    Replies: 9
    Last Post: 10-13-2004, 01:35 PM
  3. Source code of the standard library functions...
    By Nutshell in forum C Programming
    Replies: 2
    Last Post: 01-21-2002, 11:35 AM
  4. C standard library
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 12-08-2001, 11:08 AM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 11:54 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21