]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | .. Macros/Asserts//BOOST_MPL_ASSERT_NOT |
2 | ||
3 | BOOST_MPL_ASSERT_NOT | |
4 | ==================== | |
5 | ||
6 | Synopsis | |
7 | -------- | |
8 | ||
9 | .. parsed-literal:: | |
10 | ||
11 | #define BOOST_MPL_ASSERT_NOT( pred ) \\ | |
12 | |unspecified-token-seq| \\ | |
13 | /\*\*/ | |
14 | ||
15 | ||
16 | Description | |
17 | ----------- | |
18 | ||
19 | Generates a compilation error when predicate holds true. | |
20 | ||
21 | ||
22 | Header | |
23 | ------ | |
24 | ||
25 | .. parsed-literal:: | |
26 | ||
27 | #include <boost/mpl/assert.hpp> | |
28 | ||
29 | ||
30 | Parameters | |
31 | ---------- | |
32 | ||
33 | +---------------+-----------------------------------+-------------------------------------------+ | |
34 | | Parameter | Requirement | Description | | |
35 | +===============+===================================+===========================================+ | |
36 | | ``pred`` | Boolean nullary |Metafunction| | A predicate to be asserted to be false. | | |
37 | +---------------+-----------------------------------+-------------------------------------------+ | |
38 | ||
39 | ||
40 | Expression semantics | |
41 | -------------------- | |
42 | ||
43 | For any boolean nullary |Metafunction| ``pred``: | |
44 | ||
45 | ||
46 | .. parsed-literal:: | |
47 | ||
48 | BOOST_MPL_ASSERT_NOT(( pred )); | |
49 | ||
50 | :Return type: | |
51 | None. | |
52 | ||
53 | :Semantics: | |
54 | Generates a compilation error if ``pred::type::value != false``, otherwise | |
55 | has no effect. Note that double parentheses are required even if no commas | |
56 | appear in the condition. | |
57 | ||
58 | When possible within the compiler's diagnostic capabilities, | |
59 | the error message will include the predicate's full type name, and have a | |
60 | general form of: | |
61 | ||
62 | .. parsed-literal:: | |
63 | ||
64 | |...| \*\*\*\*\*\*\*\*\*\*\*\*boost::mpl::not_< pred >::\*\*\*\*\*\*\*\*\*\*\*\* |...| | |
65 | ||
66 | ||
67 | Example | |
68 | ------- | |
69 | ||
70 | :: | |
71 | ||
72 | template< typename T, typename U > struct my | |
73 | { | |
74 | // ... | |
75 | BOOST_MPL_ASSERT_NOT(( is_same< T,U > )); | |
76 | }; | |
77 | ||
78 | my<void,void> test; | |
79 | ||
80 | // In instantiation of `my<void, void>': | |
81 | // instantiated from here | |
82 | // conversion from ` | |
83 | // mpl_::failed************boost::mpl::not_<boost::is_same<void, void> | |
84 | // >::************' to non-scalar type `mpl_::assert<false>' requested | |
85 | ||
86 | ||
87 | See also | |
88 | -------- | |
89 | ||
90 | |Asserts|, |BOOST_MPL_ASSERT|, |BOOST_MPL_ASSERT_MSG|, |BOOST_MPL_ASSERT_RELATION| | |
91 | ||
92 | ||
93 |