Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the Visual Studio watch window know to expand `std::vector<T>` and show the elements?

If you expand a std::vector<T> in the watch window, you'll get items like "[0]", "[1]" etc, one for each value in the collection.

When implementing my own collection class (which, incidentally, wraps a dynamic array), I want this same functionality.

How does Visual Studio know how many elements to display in the watch window for std::vector?

like image 817
Sod Almighty Avatar asked Jan 14 '23 16:01

Sod Almighty


1 Answers

There is a file called autoexp.dat which the debugger uses to interpret custom types. It's not officially meant to be edited, but we have used it in-house for collection types and it works okay. There are some rough edges.

http://msdn.microsoft.com/en-us/library/zf0e8s14.aspx

like image 152
StilesCrisis Avatar answered Jan 17 '23 18:01

StilesCrisis