The BOOST_PP_ASSERT_MSG macro conditionally inserts debugging text.

Usage

BOOST_PP_ASSERT_MSG(cond, msg)

Arguments

cond
A condition that determines whether an assertion occurs.  Valid values range from 0 to BOOST_PP_LIMIT_MAG.
msg
A message to display if cond evaluates to 0.

Remarks

If cond expands to 0, this macro expands to msg.  Otherwise, it expands to nothing.

See Also

Requirements

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

Sample Code

#include <boost/preprocessor/comparison/equal.hpp>
#include <boost/preprocessor/debug/assert.hpp>

// lines are supposed to be counted
// in translation phase 1

#line 9
BOOST_PP_ASSERT_MSG( \
   BOOST_PP_EQUAL(__LINE__, 9), \
   "incorrect line numbering detected" \
)

© 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)