Back to Arangodb

BOOST_PP_ASSERT

3rdParty/boost/1.78.0/libs/preprocessor/doc/ref/assert.html

3.12.9.12.6 KB
Original Source

The BOOST_PP_ASSERT macro conditionally causes a preprocessing error.

Usage

BOOST_PP_ASSERT (cond)

Arguments

cond A condition that determines whether an assertion occurs. Valid values range from 0 to BOOST_PP_LIMIT_MAG.

Remarks

If cond expands to 0, this macro causes a preprocessing error. Otherwise, it expands to nothing.

See Also

Requirements

Header: <boost/preprocessor/debug/assert.hpp>

Sample Code

#include <[boost/preprocessor/cat.hpp](../headers/cat.html)>
#include <[boost/preprocessor/debug/assert.hpp](../headers/debug/assert.html)>
#include <[boost/preprocessor/logical/bitnor.hpp](../headers/logical/bitnor.html)>
#include <[boost/preprocessor/logical/compl.hpp](../headers/logical/compl.html)>

// The is BOOST_PP_IS_NULLARY macro is not part of
// the public interface of the library because it
// doesn't work on Borland preprocessors. It is
// only used here to illustrate assertions. In
// effect, it detects whether an argument is empty
// parenthesis or some text.

#include <boost/preprocessor/detail/is_nullary.hpp>

#define IS_EDISON_DESIGN_GROUP() \[BOOST\_PP\_COMPL](compl.html)( \
      BOOST_PP_IS_NULLARY( \[BOOST\_PP\_CAT](cat.html)(IS_EDG_CHECK, __EDG_VERSION) \
      ) \
   ) \
   /**/
#define IS_EDG_CHECK__EDG_VERSION ()

#define IS_METROWERKS() \[BOOST\_PP\_COMPL](compl.html)( \
      BOOST_PP_IS_NULLARY( \[BOOST\_PP\_CAT](cat.html)(IS_MWERKS_CHECK, __MWERKS__ ) \
      ) \
   ) \
   /**/
#define IS_MWERKS_CHECK __MWERKS__ ()

#define IS_MICROSOFT() \[BOOST\_PP\_BITNOR](bitnor.html)( \
      IS_MICROSOFT_ROOT(), \
      IS_EDISON_DESIGN_GROUP() \
   ) \
   /**/
#define IS_MICROSOFT_ROOT() \
   BOOST_PP_IS_NULLARY( \[BOOST\_PP\_CAT](cat.html)(IS_MSVC_CHECK, _MSC_VER) \
   ) \
   /**/
#define IS_MSVC_CHECK_MS_VER ()

// this macro doesn't work on EDG...
// (this is just an example)

#define MACRO(n) \[BOOST\_PP\_CAT](cat.html)( \
      MACRO_, \
      IS_EDISON_DESIGN_GROUP() \
   )(n) \
   /**/

#define MACRO_1(n) \[BOOST\_PP\_ASSERT](assert.html)(0) \
   "Edison Design Group is not supported" \
   /**/

#define MACRO_0(n) normal mode: n

MACRO(10)

Copyright Housemarque Oy 2002 Copyright Paul Mensonides 2002

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)