Boost logo

Boost Users :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-02-21 17:40:32


Yuval Ronen wrote:
> Hi.

> I'm talking about the detail::none_t part.
>
> Should it really be in the detail namespace? Isn't that a little
> weird? The detail namespace should be "forbidden area" for the users,
> yet here they are offered to write code like
>
> my_optional = boost::detail::none_t();

I agree that this is an incorrect use of boost::detail.

> In addition to improving the docs, I'd say that it's even better to
> include the boost/none.hpp header with optional.hpp so it could be
> easily found and reached. As I understood, the reason why this is not
> done now, is because some compilers (such as Borland's) have troubles
> with initialized data and pre-compiled headers. If this is truely the
> case, then I think it's easily solved. Include as follows:
>
> #ifndef BOOST_OPTIONAL_DISCLUDE_NONE
> #include <boost/none.hpp>
> #endif
>
> while the BOOST_OPTIONAL_DISCLUDE_NONE flag can be set either by the
> user, or automatically if a troublesome compiler is detected. If
> Boost.Config could automatically detect and set a
> BOOST_NO_INITIALIZED_DATA flag, then the optional library is left with
> fairly simple code.

The problem is that people may write code expecting it to be portable and then
discover that it fails to compile on some platforms. Making users include a
separate header forces them to confront the problem earlier; in particular it
gives them a chance to decide whether using none is worrth the cost of giving up
precompiled headers on some platforms.

Jonathan


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