Boost logo

Boost Users :

Subject: Re: [Boost-users] MSVC Visualizers Update
From: Filip Konvička (filip.konvicka_at_[hidden])
Date: 2009-04-05 14:48:58


P.S.: I was asked several times why we need to use the headers for
visualization. There are two situations that require this.

First, when a template class has multiple base classes and we need to
access data in a base class that is not listed first, we need to know
its type to be able to cast the original object. The trouble is in that
we may not use any member typedefs that typically appear in the main
class. The general rule is that the debugger does not see any aliases
introduced using typedef. As an example, we may not use

   (A::some_base_class*)&$e

This is required for visualizing Boost.MultiIndex. So we work around
this by introducing our own classes that mimic the layout of the
original classes and allow us to access the appropriate base classes (or
do some other dark magic).

The other case (introduced by this update) is the need to call custom
code for visualization. We use this for visualizing
boost::posix_time::ptime. There is no simple transformation of the
internal ptime data to a human readable form - so we use a trick that
allows us to call a user function during visualization. The function
must be simple enough (no constructors involved in the call,
well-matching argument types etc.) and it must be "accessible" - which
means visible and actually present in the translation unit (which we
enforce by having a global initializer call it in each translation unit).

I hope that this explains why we need the headers.

Cheers,
Filip


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net