The visual studio std::vector visualizer in the VS2008 autoexp.dat file doesn’t seem to work if I have a std::vector<boost::variant<...>>. It does work on other types of vectors I have tried (e.g std::vector<int>, std::vector<boost::shared_ptr<..>>)
Here is the visualizer code:
std::vector<*>{
children
(
#array
(
expr : ($e._Myfirst)[$i],
size : $e._Mylast-$e._Myfirst
)
)
preview
(
#(
"[", $e._Mylast - $e._Myfirst , "](",
#array
(
expr : ($e._Myfirst)[$i],
size : $e._Mylast-$e._Myfirst
),
")"
)
)
}
Instead of showing the number of items and the item values, the preview shows
{_Myfirst= _Mylast= _Myend= }
And the children, which should be the vector items, are the actual vector members. It’s as if the std::vector visualizer didn’t exist.
I took a screenshot of the watch window. You can see how it displays the std::vector<boost::variant<int, std::string>> wrong, and then displays the next two vectors correctly: Hyperlink to screenshot
Does anyone know what is causing this and how to stop it happening?
Thanks!
It seems to be a bug related to the size of the name of your type… boost::variant generates types with very long names.
I’ve made some tests, and it seems that the limit is a struct with name size of 497 characters. The following code reproduces the error… take the last character of the struct name, and it works fine!
Feel free to report the bug on http://connect.microsoft.com/