Billy ONeal Billy ONeal - 5 months ago 20
C++ Question

Is there an easy way to make `boost::ptr_vector` more debugger friendly in Visual Studio?

I'm considering using

as a result of the responses from this question. My biggest problem with the library is that I cannot view the contents of the collection in the debugger, because the MSVC debugger doesn't recognize it, and therefore I cannot see the contents of the containers. (All the data gets stored as
void *

I've heard MSVC has a feature called "debugger visualizers" which would allow the user to make the debugger smarter about these kinds of things, but I've never written anything like this, and I'm not hugely firmiliar with such things.

For example, compare the behavior of
with MSVC's own
. In the debugger (i.e. in the Watch window), the boost version shows up as a big mess of internal variables used for implementing the shared pointer, but the MSVC version shows up as a plain pointer to the object (and the
's innards are hidden).

How can I get started either using or implementing such a thing?


See this link which provides every debugger visualizer (through autoexp.dat) you may want :

All visualizers are available in the svn. Currently, we support the following Boost types:

  • boost::array, ptr_array, ptr_deque, ptr_list, ptr_map, ptr_multimap, ptr_set, ptr_multiset, ptr_vector
  • boost::interprocess::offset_ptr
  • boost::optional
  • boost::multi_index_container
  • boost::shared_ptr
  • boost::posix_time::ptime,
  • boost::posix_time::time_duration (two variants are available)
  • boost::regex
  • boost::variant