]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | .. Data Types/Numeric//bool_ |10 |
2 | ||
3 | bool\_ | |
4 | ====== | |
5 | ||
6 | Synopsis | |
7 | -------- | |
8 | ||
9 | .. parsed-literal:: | |
10 | ||
11 | template< | |
12 | bool C | |
13 | > | |
14 | struct bool\_ | |
15 | { | |
16 | // |unspecified| | |
17 | // ... | |
18 | }; | |
19 | ||
20 | typedef bool_<true> true\_; | |
21 | typedef bool_<false> false\_; | |
22 | ||
23 | ||
24 | Description | |
25 | ----------- | |
26 | ||
27 | A boolean |Integral Constant| wrapper. | |
28 | ||
29 | ||
30 | Header | |
31 | ------ | |
32 | ||
33 | .. parsed-literal:: | |
34 | ||
35 | #include <boost/mpl/bool.hpp> | |
36 | ||
37 | ||
38 | Model of | |
39 | -------- | |
40 | ||
41 | |Integral Constant| | |
42 | ||
43 | ||
44 | Parameters | |
45 | ---------- | |
46 | ||
47 | +---------------+-------------------------------+---------------------------+ | |
48 | | Parameter | Requirement | Description | | |
49 | +===============+===============================+===========================+ | |
50 | | ``C`` | A boolean integral constant | A value to wrap. | | |
51 | +---------------+-------------------------------+---------------------------+ | |
52 | ||
53 | Expression semantics | |
54 | -------------------- | |
55 | ||
56 | |Semantics disclaimer...| |Integral Constant|. | |
57 | ||
58 | For arbitrary integral constant ``c``: | |
59 | ||
60 | +-------------------+-----------------------------------------------------------+ | |
61 | | Expression | Semantics | | |
62 | +===================+===========================================================+ | |
63 | | ``bool_<c>`` | An |Integral Constant| ``x`` such that ``x::value == c`` | | |
64 | | | and ``x::value_type`` is identical to ``bool``. | | |
65 | +-------------------+-----------------------------------------------------------+ | |
66 | ||
67 | ||
68 | Example | |
69 | ------- | |
70 | ||
71 | .. parsed-literal:: | |
72 | ||
73 | BOOST_MPL_ASSERT(( is_same< bool_<true>::value_type, bool > )); | |
74 | BOOST_MPL_ASSERT(( is_same< bool_<true>, true\_ > )); } | |
75 | BOOST_MPL_ASSERT(( is_same< bool_<true>::type, bool_<true> > )); | |
76 | BOOST_MPL_ASSERT_RELATION( bool_<true>::value, ==, true ); | |
77 | assert( bool_<true>() == true ); | |
78 | ||
79 | ||
80 | See also | |
81 | -------- | |
82 | ||
83 | |Data Types|, |Integral Constant|, |int_|, |long_|, |integral_c| | |
84 | ||
85 | ||
86 | .. |true_| replace:: `true_`_ | |
87 | .. _`true_`: `bool_`_ | |
88 | ||
89 | .. |false_| replace:: `false_`_ | |
90 | .. _`false_`: `bool_`_ | |
91 | ||
92 | ||
93 |