Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-11-24 08:15:07


From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>
> Is there a chance of adding a loki-like macro to static_assert.hpp that
> would allow a user-defined message to be (likely) included in the error
> message?
>
> The idea is to allow the user to specify an error message in the form of
an
> identifier.
>
> #define STATIC_ASSERT_MSG(b, msg) \
> { \
> struct msg \
> { \
> msg(::boost::loki::int2type<true>) {} \
> } msg(::boost::loki::int2type<(b) != 0>()); \
> }

I use

typedef char error_message_here[expr];

Not as elegant as a macro and doesn't use int2type, granted. ;-)

--
Peter Dimov
Multi Media Ltd.

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