Groups | Blog | Home
all groups > visual studio .net debugging > december 2004 >

visual studio .net debugging : Debugging the contents of a std::vector


OrbitalTug
12/21/2004 11:42:11 PM
Hi

When debugging I often want to inspect the contents of vectors. I usually do
this with a watch window statement like:

myVec._First[0]

thus showing the contents of the first element etc.
Even better: To see a list of several elements in the vector I use a
statement like:

myVec._First,10

This gives a tree with the first 10 elements of the vector as expandable
nodes. Very neat. But sadly this does not always work. A lot of the time I
just get an error when trying to use the , syntax. Does anyone know why?
Could it be related to the contents of the vector (e.g. pointers or simple
types), or is it related to the scope of the vector variable (local, global,
class member etc)? Any workarounds to make it work always? ,10 is so much
faster than having to check [0], [1],...[9] one at a time...

Tug.

v-garych NO[at]SPAM online.microsoft.com
12/22/2004 7:47:26 AM
Hi Tug,

[quoted text, click to view]

The syntax appears alright, however the "myVec._First,10" is the VC6.0's
syntax, and under VC7.1, it should be "myVec._Myfirst,10".

If it is not your problem, would you please give us some scenario while
this watch statement does'n work?


Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
mrg
5/1/2007 11:09:43 AM
Visual Studio 2005 debug watch windows fail to honor that syntax. at most i can get the entire vector displayed. not usefull if i want to see element 999901.

From http://www.developmentnow.com/g/51_2004_12_0_0_29825/Debugging-the-contents-of-a-stdvector.htm

Posted via DevelopmentNow.com Groups
AddThis Social Bookmark Button