Back to Arangodb

BOOST_MPL_ASSERT_MSG

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/assert-msg.html

3.12.9.13.4 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Macros / Asserts / BOOST_MPL_ASSERT_MSG |

BOOST_MPL_ASSERT_MSG

Synopsis

#define[BOOST\_MPL\_ASSERT\_MSG](./assert-msg.html)( condition, message, types ) \_unspecified token sequence_\
/**/

Description

Generates a compilation error with an embedded custom message when the condition doesn't hold.

#include <[boost/mpl/assert.hpp](../../../../boost/mpl/assert.hpp)>

Parameters

ParameterRequirementDescription
conditionAn integral constant expressionA condition to be asserted.
messageA legal identifier tokenA custom message in a form of a legal C++ identifier token.
typesA legal function parameter listA parenthized list of types to be displayed in the error message.

Expression semantics

For any integral constant expression expr, legal C++ identifier message, and arbitrary types t1, t2,... tn:

[BOOST\_MPL\_ASSERT\_MSG](./assert-msg.html)( expr, message, (t1, t2,... tn) );

| Return type: |

None.

| | Precondition: |

t1, t2,... tn are non-void.

| | Semantics: |

Generates a compilation error if expr != true, otherwise has no effect.

When possible within the compiler's diagnostic capabilities, the error message will include the message identifier and the parenthized list of t1, t2,... tn types, and have a general form of:

_..._************(_..._::message )************)(t1, t2,... tn)_..._

|

[BOOST\_MPL\_ASSERT\_MSG](./assert-msg.html)( expr, message, (types<t1, t2,... tn>) );

| Return type: |

None.

| | Precondition: |

None.

| | Semantics: |

Generates a compilation error if expr != true, otherwise has no effect.

When possible within the compiler's diagnostics capabilities, the error message will include the message identifier and the list of t1, t2,... tn types, and have a general form of:

_..._************(_..._::message )************)(types<t1, t2,... tn>)_..._

|

Example

template< typename T > struct my
{
    // ...[BOOST\_MPL\_ASSERT\_MSG](./assert-msg.html)(
          is_integral<T>::value
        , NON_INTEGRAL_TYPES_ARE_NOT_ALLOWED
        , (T)
        );
};

my<void*> test;

// In instantiation of `my<void*>':
// instantiated from here
// conversion from `
// mpl_::failed ************ (my<void*>::
// NON_INTEGRAL_TYPES_ARE_NOT_ALLOWED:: ************ )(void*)
// ' to non-scalar type `mpl_::assert<false>' requested

See also

Asserts, BOOST_MPL_ASSERT, BOOST_MPL_ASSERT_NOT, BOOST_MPL_ASSERT_RELATION

| Prev Next | Back Along | Up Home | Full TOC |

Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |