Chris@16: Chris@16: // Copyright Aleksey Gurtovoy 2000-2006 Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // See http://www.boost.org/libs/mpl for documentation. Chris@16: Chris@101: // $Id$ Chris@101: // $Date$ Chris@101: // $Revision$ Chris@16: Chris@16: // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION! Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #if !defined(AUX_WRAPPER_NAME) Chris@16: # define AUX_WRAPPER_NAME BOOST_PP_CAT(AUX_WRAPPER_VALUE_TYPE,_) Chris@16: #endif Chris@16: Chris@16: #if !defined(AUX_WRAPPER_PARAMS) Chris@16: # define AUX_WRAPPER_PARAMS(N) BOOST_MPL_AUX_NTTP_DECL(AUX_WRAPPER_VALUE_TYPE, N) Chris@16: #endif Chris@16: Chris@16: #if !defined(AUX_WRAPPER_INST) Chris@16: # if BOOST_WORKAROUND(__MWERKS__, <= 0x2407) Chris@16: # define AUX_WRAPPER_INST(value) AUX_WRAPPER_NAME< value > Chris@16: # else Chris@16: # define AUX_WRAPPER_INST(value) BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::AUX_WRAPPER_NAME< value > Chris@16: # endif Chris@16: #endif Chris@16: Chris@16: BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN Chris@16: Chris@16: template< AUX_WRAPPER_PARAMS(N) > Chris@16: struct AUX_WRAPPER_NAME Chris@16: { Chris@16: BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, value = N); Chris@16: // agurt, 08/mar/03: SGI MIPSpro C++ workaround, have to #ifdef because some Chris@16: // other compilers (e.g. MSVC) are not particulary happy about it Chris@16: #if BOOST_WORKAROUND(__EDG_VERSION__, <= 238) Chris@16: typedef struct AUX_WRAPPER_NAME type; Chris@16: #else Chris@16: typedef AUX_WRAPPER_NAME type; Chris@16: #endif Chris@16: typedef AUX_WRAPPER_VALUE_TYPE value_type; Chris@16: typedef integral_c_tag tag; Chris@16: Chris@16: // have to #ifdef here: some compilers don't like the 'N + 1' form (MSVC), Chris@16: // while some other don't like 'value + 1' (Borland), and some don't like Chris@16: // either Chris@16: #if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) Chris@16: private: Chris@16: BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1))); Chris@16: BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1))); Chris@16: public: Chris@16: typedef AUX_WRAPPER_INST(next_value) next; Chris@16: typedef AUX_WRAPPER_INST(prior_value) prior; Chris@16: #elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ Chris@16: || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \ Chris@16: || (BOOST_WORKAROUND(__HP_aCC, <= 53800) && (BOOST_WORKAROUND(__hpxstd98, != 1))) Chris@16: typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next; Chris@16: typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior; Chris@16: #else Chris@16: typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value + 1)) ) next; Chris@16: typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior; Chris@16: #endif Chris@16: Chris@16: // enables uniform function call syntax for families of overloaded Chris@16: // functions that return objects of both arithmetic ('int', 'long', Chris@16: // 'double', etc.) and wrapped integral types (for an example, see Chris@16: // "mpl/example/power.cpp") Chris@101: BOOST_CONSTEXPR operator AUX_WRAPPER_VALUE_TYPE() const { return static_cast(this->value); } Chris@16: }; Chris@16: Chris@16: #if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) Chris@16: template< AUX_WRAPPER_PARAMS(N) > Chris@16: AUX_WRAPPER_VALUE_TYPE const AUX_WRAPPER_INST(N)::value; Chris@16: #endif Chris@16: Chris@16: BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE Chris@16: Chris@16: #undef AUX_WRAPPER_NAME Chris@16: #undef AUX_WRAPPER_PARAMS Chris@16: #undef AUX_WRAPPER_INST Chris@16: #undef AUX_WRAPPER_VALUE_TYPE