]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/doc/src/refmanual/ASSERT_RELATION.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / ASSERT_RELATION.rst
1 .. Macros/Asserts//BOOST_MPL_ASSERT_RELATION
2
3 BOOST_MPL_ASSERT_RELATION
4 =========================
5
6 Synopsis
7 --------
8
9 .. parsed-literal::
10
11 #define BOOST_MPL_ASSERT_RELATION( x, relation, y ) \\
12 |unspecified-token-seq| \\
13 /\*\*/
14
15
16
17 Description
18 -----------
19
20 A specialized assertion macro for checking numerical conditions. Generates
21 a compilation error when the condition ``( x relation y )``
22 doesn't hold.
23
24
25 Header
26 ------
27
28 .. parsed-literal::
29
30 #include <boost/mpl/assert.hpp>
31
32
33 Parameters
34 ----------
35
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 |
44 | | | checked. |
45 +---------------+-----------------------------------+-----------------------------------------------+
46
47
48 Expression semantics
49 --------------------
50
51 For any integral constants ``x``, ``y`` and a legal C++ operator token ``op``:
52
53
54 .. parsed-literal::
55
56 BOOST_MPL_ASSERT_RELATION( x, op, y );
57
58 :Return type:
59 None.
60
61 :Semantics:
62 Generates a compilation error if ``( x op y ) != true``, otherwise
63 has no effect.
64
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:
68
69 .. parsed-literal::
70
71 |...| \*\*\*\*\*\*\*\*\*\*\*\*\ |...|\ assert_relation<op, x, y>::\*\*\*\*\*\*\*\*\*\*\*\*) |...|
72
73
74 Example
75 -------
76
77 ::
78
79 template< typename T, typename U > struct my
80 {
81 // ...
82 BOOST_MPL_ASSERT_RELATION( sizeof(T), <, sizeof(U) );
83 };
84
85 my<char[50],char[10]> test;
86
87 // In instantiation of `my<char[50], char[10]>':
88 // instantiated from here
89 // conversion from `
90 // mpl_::failed************mpl_::assert_relation<less, 50, 10>::************'
91 // to non-scalar type `mpl_::assert<false>' requested
92
93
94 See also
95 --------
96
97 |Asserts|, |BOOST_MPL_ASSERT|, |BOOST_MPL_ASSERT_NOT|, |BOOST_MPL_ASSERT_MSG|
98
99
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)