20
20
struct integral_constant : public mpl::integral_c<T, val>
22
//BOOST_STATIC_CONSTANT(T, value = val);
23
//typedef T value_type;
24
22
typedef integral_constant<T,val> type;
28
// everything that follows now, is MPL-compatibility code:
30
typedef ::boost::mpl::integral_c_tag tag;
32
// have to #ifdef here: some compilers don't like the 'val + 1' form (MSVC),
33
// while some other don't like 'value + 1' (Borland), and some don't like
35
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
37
BOOST_STATIC_CONSTANT(T, next_value = BOOST_MPL_AUX_STATIC_CAST(T, (val + 1)));
38
BOOST_STATIC_CONSTANT(T, prior_value = BOOST_MPL_AUX_STATIC_CAST(T, (val - 1)));
40
typedef integral_constant<T,next_value> next;
41
typedef integral_constant<T,prior_value> prior;
42
#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
43
|| BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \
44
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800))
45
typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val + 1)) )> next;
46
typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val - 1)) )> prior;
48
typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value + 1)) )> next;
49
typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value - 1)) )> prior;
52
// enables uniform function call syntax for families of overloaded
53
// functions that return objects of both arithmetic ('int', 'long',
54
// 'double', etc.) and wrapped integral types (for an example, see
55
// "mpl/example/power.cpp")
56
operator T() const { return static_cast<T>(this->value); }
60
25
template<> struct integral_constant<bool,true> : public mpl::true_
62
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
27
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
28
# pragma warning(push)
29
# pragma warning(disable:4097)
63
30
typedef mpl::true_ base_;
64
31
using base_::value;
66
34
typedef integral_constant<bool,true> type;
68
36
template<> struct integral_constant<bool,false> : public mpl::false_
70
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
38
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
39
# pragma warning(push)
40
# pragma warning(disable:4097)
71
41
typedef mpl::false_ base_;
72
42
using base_::value;
74
45
typedef integral_constant<bool,false> type;