• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Data Types/Numeric//bool_ |10
2
3bool\_
4======
5
6Synopsis
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
24Description
25-----------
26
27A boolean |Integral Constant| wrapper.
28
29
30Header
31------
32
33.. parsed-literal::
34
35    #include <boost/mpl/bool.hpp>
36
37
38Model of
39--------
40
41|Integral Constant|
42
43
44Parameters
45----------
46
47+---------------+-------------------------------+---------------------------+
48| Parameter     | Requirement                   | Description               |
49+===============+===============================+===========================+
50| ``C``         | A boolean integral constant   | A value to wrap.          |
51+---------------+-------------------------------+---------------------------+
52
53Expression semantics
54--------------------
55
56|Semantics disclaimer...| |Integral Constant|.
57
58For 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
68Example
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
80See 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.. 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)
96