Back to Arangodb

BOOST_MPL_ASSERT_RELATION

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

3.12.9.12.7 KB
Original Source

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

BOOST_MPL_ASSERT_RELATION

Synopsis

#define[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)( x, relation, y ) \_unspecified token sequence_\
/**/

Description

A specialized assertion macro for checking numerical conditions. Generates a compilation error when the condition ( x relation y ) doesn't hold.

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

Parameters

ParameterRequirementDescription
xAn integral constantLeft operand of the checked relation.
yAn integral constantRight operand of the checked relation.
relationA C++ operator tokenAn operator token for the relation being checked.

Expression semantics

For any integral constants x, y and a legal C++ operator token op:

[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)( x, op, y );

| Return type: |

None.

| | Semantics: |

Generates a compilation error if ( x op y ) != true, otherwise has no effect.

When possible within the compiler's diagnostic capabilities, the error message will include a name of the relation being checked, the actual values of both operands, and have a general form of:

_..._ ************_..._assert_relation<op, x, y>::************ )_..._

|

Example

template< typename T, typename U > struct my
{
    // ...[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)( sizeof(T), <, sizeof(U) );
};

my<char[50],char[10]> test;

// In instantiation of `my<char[50], char[10]>':
// instantiated from here
// conversion from `
// mpl_::failed************mpl_::assert_relation<[less](./less.html), 50, 10>::************'
// to non-scalar type `mpl_::assert<false>' requested

See also

Asserts, BOOST_MPL_ASSERT, BOOST_MPL_ASSERT_NOT, BOOST_MPL_ASSERT_MSG

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