Boost C++ Libraries 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 / char_



      char N
struct char_
    // unspecified
    // ...


An Integral Constant wrapper for char.


#include <boost/mpl/char.hpp>

Model of

Integral Constant


Parameter Requirement Description
N A character 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 character constant c:

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


typedef char_<'c'> c;

BOOST_MPL_ASSERT(( is_same< c::value_type, char > ));
BOOST_MPL_ASSERT(( is_same< c::type, c > ));
BOOST_MPL_ASSERT(( is_same< next< c >::type, char_<'d'> > ));
BOOST_MPL_ASSERT(( is_same< prior< c >::type, char_<'b'> > ));
BOOST_MPL_ASSERT_RELATION( (c::value), ==, 'c' );
assert( c() == 'c' );

See also

Data Types, Integral Constant, int_, size_t, integral_c