1 .. Data Types/Numeric//integral_c |50
24 A generic |Integral Constant| wrapper.
32 #include <boost/mpl/integral_c.hpp>
44 +---------------+-------------------------------+---------------------------+
45 | Parameter | Requirement | Description |
46 +===============+===============================+===========================+
47 | ``T`` | An integral type | Wrapper's value type. |
48 +---------------+-------------------------------+---------------------------+
49 | ``N`` | An integral constant | A value to wrap. |
50 +---------------+-------------------------------+---------------------------+
56 |Semantics disclaimer...| |Integral Constant|.
58 For arbitrary integral type ``t`` and integral constant ``n``:
60 +-----------------------+-----------------------------------------------------------+
61 | Expression | Semantics |
62 +=======================+===========================================================+
63 | ``integral_c<t,c>`` | An |Integral Constant| ``x`` such that ``x::value == c`` |
64 | | and ``x::value_type`` is identical to ``t``. |
65 +-----------------------+-----------------------------------------------------------+
73 typedef integral_c<short,8> eight;
75 BOOST_MPL_ASSERT(( is_same< eight::value_type, short > ));
76 BOOST_MPL_ASSERT(( is_same< eight::type, eight > ));
77 BOOST_MPL_ASSERT(( is_same< next< eight >::type, integral_c<short,9> > ));
78 BOOST_MPL_ASSERT(( is_same< prior< eight >::type, integral_c<short,7> > ));
79 BOOST_MPL_ASSERT_RELATION( (eight::value), ==, 8 );
80 assert( eight() == 8 );
86 |Data Types|, |Integral Constant|, |bool_|, |int_|, |long_|, |size_t|
89 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
90 Distributed under the Boost Software License, Version 1.0. (See accompanying
91 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)