1 .. Macros/Asserts//BOOST_MPL_ASSERT_RELATION
3 BOOST_MPL_ASSERT_RELATION
4 =========================
11 #define BOOST_MPL_ASSERT_RELATION( x, relation, y ) \\
12 |unspecified-token-seq| \\
20 A specialized assertion macro for checking numerical conditions. Generates
21 a compilation error when the condition ``( x relation y )``
30 #include <boost/mpl/assert.hpp>
36 +---------------+-----------------------------------+-----------------------------------------------+
37 | Parameter | Requirement | Description |
38 +===============+===================================+===============================================+
39 | ``x`` | An integral constant | Left operand of the checked relation. |
40 +---------------+-----------------------------------+-----------------------------------------------+
41 | ``y`` | An integral constant | Right operand of the checked relation. |
42 +---------------+-----------------------------------+-----------------------------------------------+
43 | ``relation`` | A C++ operator token | An operator token for the relation being |
45 +---------------+-----------------------------------+-----------------------------------------------+
51 For any integral constants ``x``, ``y`` and a legal C++ operator token ``op``:
56 BOOST_MPL_ASSERT_RELATION( x, op, y );
62 Generates a compilation error if ``( x op y ) != true``, otherwise
65 When possible within the compiler's diagnostic capabilities,
66 the error message will include a name of the relation being checked,
67 the actual values of both operands, and have a general form of:
71 |...| \*\*\*\*\*\*\*\*\*\*\*\*\ |...|\ assert_relation<op, x, y>::\*\*\*\*\*\*\*\*\*\*\*\*) |...|
79 template< typename T, typename U > struct my
82 BOOST_MPL_ASSERT_RELATION( sizeof(T), <, sizeof(U) );
85 my<char[50],char[10]> test;
87 // In instantiation of `my<char[50], char[10]>':
88 // instantiated from here
90 // mpl_::failed************mpl_::assert_relation<less, 50, 10>::************'
91 // to non-scalar type `mpl_::assert<false>' requested
97 |Asserts|, |BOOST_MPL_ASSERT|, |BOOST_MPL_ASSERT_NOT|, |BOOST_MPL_ASSERT_MSG|
100 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
101 Distributed under the Boost Software License, Version 1.0. (See accompanying
102 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)