Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Front Page / Data Types / Numeric / bool_

bool_

Synopsis

template<
      bool C
    >
struct bool_
{
    // unspecified
    // ...
};

typedef bool_<true>  true_;
typedef bool_<false> false_;

Description

A boolean Integral Constant wrapper.

Header

#include <boost/mpl/bool.hpp>

Model of

Integral Constant

Parameters

Parameter Requirement Description
C A boolean integral constant A value to wrap.

Expression semantics

The semantics of an expression are defined only where they differ from, or are not defined in Integral Constant.

For arbitrary integral constant c:

Expression Semantics
bool_<c> An Integral Constant x such that x::value == c and x::value_type is identical to bool.

Example

BOOST_MPL_ASSERT(( is_same< bool_<true>::value_type, bool > ));
BOOST_MPL_ASSERT(( is_same< bool_<true>, true_ > )); }
BOOST_MPL_ASSERT(( is_same< bool_<true>::type, bool_<true> > ));
BOOST_MPL_ASSERT_RELATION( bool_<true>::value, ==, true );
assert( bool_<true>() == true );

See also

Data Types, Integral Constant, int_, long_, integral_c