diff --git a/include/boost/mpl/integral_c.hpp b/include/boost/mpl/integral_c.hpp index f0de576..bd4088f 100644 --- a/include/boost/mpl/integral_c.hpp +++ b/include/boost/mpl/integral_c.hpp @@ -37,24 +37,27 @@ struct integral_c typedef integral_c type; typedef T value_type; + // Note that the static_casts below are there to handle the case + // where T is an enum type. + // have to #ifdef here: some compilers don't like the 'N + 1' form (MSVC), // while some other don't like 'value + 1' (Borland), and some don't like // either #if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 243 private: - BOOST_STATIC_CONSTANT(T, next_value = (N + 1)); - BOOST_STATIC_CONSTANT(T, prior_value = (N - 1)); + BOOST_STATIC_CONSTANT(T, next_value = static_cast(N + 1)); + BOOST_STATIC_CONSTANT(T, prior_value = static_cast(N - 1)); public: typedef integral_c next; typedef integral_c prior; #elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \ || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800)) - typedef integral_c next; - typedef integral_c prior; + typedef integral_c(N + 1)> next; + typedef integral_c(N - 1)> prior; #else - typedef integral_c next; - typedef integral_c prior; + typedef integral_c(value + 1)> next; + typedef integral_c(value - 1)> prior; #endif // enables uniform function call syntax for families of overloaded