David Abrahams wrote:
Edward Diener
writes: Pierre THIERRY wrote:
Le Sat, 17 Jun 2006 18:53:19 -0400, David Abrahams a écrit :
Usually, in the debugger, you cast the base address of the actual
storage to a pointer to the type stored, and go from there.
Thanks a lot, it did the trick! In fact, I immediately ran into problems
about namespaces, but I managed to find in recent gdb newsgroups
postings how to do...
So now I can debug my varaints! Maybe that could be valuable if such an
information was in the Boost documentation?
What Dave suggested is standard information for anyone using a debugger
in C++. Putting that in the Boost documentation is unnecessary.
I disagree. Certainly Pierre's experience belies that statement.
More generally, variant presents a high-level abstraction, and users
aren't necessarily expected to have any idea how it works internally.
For the most part, a naive user with a good debugger can explore his
program's data structures at will, but unlike almost any other library
component, variant is a barrier to the type information the debugger
needs.
Variant isn't the only data structure where the actual type stored is not known at compile time and therefore unavailable to the debugger to show to the user. You yourself pointed out the others. Every good programmer of which I know is cognizant of the technique of casting the variable or memory area, from within a debugger, to the actual type so that the debugger shows the value. Are you saying it should be up to Boost to tell the programmer about this technique ? I am not saying it might not be helpful, but I do not think it belongs in the documentation as a general rule since the technique is universal to other similar situations, and not to just one or two Boost libraries.