# C++ Is it possible to get STL vector like debugging features for a non STL vector class

## Recommended Posts

I have always been confused about how std::vector class gets the debugging info. You get a nice list of all the elements in the vector. Whereas, for non-stl vector classes which I have written or used, all you get to see is the first element(begin) and the last element (end) which is just garbage memory.

We don't use any STL code in our engine for obvious reasons but sometimes it's nice to view the contents inside the vector

Does Visual studio have some special logic to show all elements of the std::vector in the debug view?

##### Share on other sites

In Visual Studio you could also use the "autoexp.dat" file in

%VSINSTALLDIR%\Common7\Packages\Debugger\autoexp.dat

for VS2010 and previous (I do not know if this works from 2012 upwards) and write something like this into the file

;------------------------------------------------------------------------------
;  Drough::Vector from <Vector.h>
;------------------------------------------------------------------------------
; vector is previewed with "[<size>](<elements>)".
; It has [size] and [capacity] children, followed by its elements.
; The other containers follow its example.
Drough::Vector<*>{
preview (
#(
"[",
$e.elementCount, "](", #array( expr:$e.data[$i], size:$e.elementCount
),
")"
)
)

children (
#(
#([size] : $e.elementCount), #([capacity] :$e.arraySize),
#array(
expr: $e.data[$i],
size: \$e.elementCount
)
)
)
}

## Create an account

Register a new account

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 29
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631773
• Total Posts
3002269
×