1 .. Macros/Asserts//BOOST_MPL_ASSERT
11 #define BOOST_MPL_ASSERT( pred ) \\
12 |unspecified-token-seq| \\
19 Generates a compilation error when the predicate ``pred`` holds false.
27 #include <boost/mpl/assert.hpp>
33 +---------------+-----------------------------------+-------------------------------+
34 | Parameter | Requirement | Description |
35 +===============+===================================+===============================+
36 | ``pred`` | Boolean nullary |Metafunction| | A predicate to be asserted. |
37 +---------------+-----------------------------------+-------------------------------+
43 For any boolean nullary |Metafunction| ``pred``:
48 BOOST_MPL_ASSERT(( pred ));
54 Generates a compilation error if ``pred::type::value != true``, otherwise
55 has no effect. Note that double parentheses are required even if no commas
56 appear in the condition.
58 When possible within the compiler's diagnostic capabilities,
59 the error message will include the predicate's full type name, and have a
64 |...| \*\*\*\*\*\*\*\*\*\*\*\* pred::\*\*\*\*\*\*\*\*\*\*\*\* |...|
72 template< typename T, typename U > struct my
75 BOOST_MPL_ASSERT(( is_same< T,U > ));
80 // In instantiation of `my<void, char*>':
81 // instantiated from here
83 // mpl_::failed************boost::is_same<void, char*>::************' to
84 // non-scalar type `mpl_::assert<false>' requested
90 |Asserts|, |BOOST_MPL_ASSERT_NOT|, |BOOST_MPL_ASSERT_MSG|, |BOOST_MPL_ASSERT_RELATION|
93 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
94 Distributed under the Boost Software License, Version 1.0. (See accompanying
95 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)