Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 1999-12-08 12:19:02


I'm not sure why the class has to be named. I found that this variant of
your implementation works well, but I'm not sure that it's portable.

    namespace boost
    {
        #define CTASSERT(condition) struct { enum { \
            check = ::boost::compile_time_assert<condition>:: \
            compile_time_assertion_failed }; }

        template<bool> struct compile_time_assert;
        template<> struct compile_time_assert<false> { };
        template<> struct compile_time_assert<true>
            { enum { compile_time_assertion_failed}; };
    }

I think the name CTASSERT is cryptic, although it's good that it's short.

The original implementation had an extra semicolon in the definition of
CTASSERT which made it an error to have another semicolon after it when it's
in a declaration. I removed the semicolon.

The specializations of the compile_time_assert struct did not use the
"template<>" syntax, so I added that.

    -- Darin


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