Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2007-05-23 00:13:41

Hi Jeffrey,

In my experience, changing the class layout based on a preprocessor switch
is a very bad idea since it breaks binary compatibility with libraries
compiled with a different switch, so I strongly suggest you/we find a better

If this functionality is really really needed (read below), I would create a
*different* template class to offer it. One such debugger-friendly
optional<> would replace (rather than add) the bool field with a T* field
(which would be set to NULL when uninitialized). A different template class
makes sure that binary-differing optional's don't mix accidentally (in the
same wa a policy-based design does it).

But I'm curious: doesn't a simple dynamic watch, like "*opt", works?? That
calls a method on the object, yes, but debuggers have been able to do that
for decades now.

Or perhaps your problem is that you don't want to be watching/inspecting
"*opt" manually?
I'm using C# a lot lately and it has a nice feature: the debugger
automatically calls .ToString() on any variable it shows. That's *so*
useful. Doesn't VC++ has some sort of similar mechanism?


Fernando Cacciola

Boost list run by bdawes at, gregod at, cpdaniel at, john at