Boost logo

Boost :

From: Hamish Mackenzie (hamish_at_[hidden])
Date: 2005-10-17 08:53:28


On Thu, 2005-10-13 at 13:51 -0300, Fernando Cacciola wrote:
> > Agreed. And a good way to do that is to produce an updated version of
> > the proposal with several use cases showing actual code using both
> > interfaces, and pointing out exactly how the pointer interface is
> > superior.
> OK.
> I'll do that.

Don't forget to include this
http://boost.org/libs/optional/doc/optional.html#bool
as a counter example.

Currently we are using a wrapper around boost::optional that hides the
pointer interface and provides instead empty() and value() (though
has_value() and value() may be better to avoid confusion for things like
optional<Some_STD_Container>).

We use optional<bool> all over the place in classes read/written from
databases and xml. Refactoring a bool to an optional<bool> would be a
nightmare with the pointer interface. It is made worse by the fact that
we generate some C++ code from the DB schema so someone changing from a
"bit not null" to a "bit null" (aka "boolean null") in a table
definition would quietly break our code at runtime (instead of causing a
compiler error in the appropriate place).

Hamish


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk