Sunday, September 27, 2009

Showing std::vector in the debugger (continued)

Seems I found an even better way to show the container elements in the debugger: just add a watch for the address of the std::vector instance!

For example:
std::vector <> oList;
oList.push_back( -1 );
oList.push_back( 6 );
__asm int 3 /// Breakpoint here...


Add a watch for :
&oList


And it expands to (correctly sizing it!)
oList[ 0 ] = -1;
oList[ 1 ] = 6;

No comments: