Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2008-06-21 03:38:07


David Abrahams wrote:

> For several releases now we've had a suite of static assertion tools
> that give far superior error messages to what BOOST_STATIC_ASSERT can
> provide
> (http://www.boost.org/doc/libs/1_35_0/libs/mpl/doc/refmanual/asserts.html).
> I think <radical-idea>it's time to deprecate
> BOOST_STATIC_ASSERT</radical-idea> or at *least* put a prominent note in
> its documentation directing people at the BOOST_MPL_ASSERT macros.
>
> Thoughts?

One of the best things of BOOST_STATIC_ASSERT is that it's very
lightweight and has just basic depedencies:

#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>

Looking mpl/assert.hpp:

#include <boost/mpl/not.hpp>
#include <boost/mpl/aux_/value_wknd.hpp>
#include <boost/mpl/aux_/nested_type_wknd.hpp>
#include <boost/mpl/aux_/yes_no.hpp>
#include <boost/mpl/aux_/na.hpp>
#include <boost/mpl/aux_/adl_barrier.hpp>

#include <boost/mpl/aux_/config/nttp.hpp>
#include <boost/mpl/aux_/config/dtp.hpp>
#include <boost/mpl/aux_/config/gcc.hpp>
#include <boost/mpl/aux_/config/msvc.hpp>
#include <boost/mpl/aux_/config/static_constant.hpp>
#include <boost/mpl/aux_/config/pp_counter.hpp>
#include <boost/mpl/aux_/config/workaround.hpp>

#include <boost/preprocessor/cat.hpp>

#include <boost/config.hpp> // make sure 'size_t' is placed into 'std'
#include <cstddef>

This sounds a bit heavy. Can't we improve BOOST_STATIC_ASSERT a bit (or
make mpl/assert.hpp a bit more lightweight)? For newer compilers
BOOST_STATIC_ASSERT will be just a macro defining standard static assert.

Regards,

Ion


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