epoc32/include/stdapis/boost/mpl/aux_/integral_wrapper.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 
     2 // Copyright Aleksey Gurtovoy 2000-2006
     3 //
     4 // Distributed under the Boost Software License, Version 1.0. 
     5 // (See accompanying file LICENSE_1_0.txt or copy at 
     6 // http://www.boost.org/LICENSE_1_0.txt)
     7 //
     8 // See http://www.boost.org/libs/mpl for documentation.
     9 
    10 // $Source: /cvsroot/boost/boost/boost/mpl/aux_/integral_wrapper.hpp,v $
    11 // $Date: 2006/11/08 21:44:30 $
    12 // $Revision: 1.10.14.1 $
    13 
    14 // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION!
    15 
    16 #include <boost/mpl/integral_c_tag.hpp>
    17 #include <boost/mpl/aux_/static_cast.hpp>
    18 #include <boost/mpl/aux_/nttp_decl.hpp>
    19 #include <boost/mpl/aux_/config/static_constant.hpp>
    20 #include <boost/mpl/aux_/config/workaround.hpp>
    21 
    22 #include <boost/preprocessor/cat.hpp>
    23 
    24 #if !defined(AUX_WRAPPER_NAME)
    25 #   define AUX_WRAPPER_NAME BOOST_PP_CAT(AUX_WRAPPER_VALUE_TYPE,_)
    26 #endif
    27 
    28 #if !defined(AUX_WRAPPER_PARAMS)
    29 #   define AUX_WRAPPER_PARAMS(N) BOOST_MPL_AUX_NTTP_DECL(AUX_WRAPPER_VALUE_TYPE, N)
    30 #endif
    31 
    32 #if !defined(AUX_WRAPPER_INST)
    33 #   if BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
    34 #       define AUX_WRAPPER_INST(value) AUX_WRAPPER_NAME< value >
    35 #   else 
    36 #       define AUX_WRAPPER_INST(value) BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::AUX_WRAPPER_NAME< value >
    37 #   endif
    38 #endif
    39 
    40 BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
    41 
    42 template< AUX_WRAPPER_PARAMS(N) >
    43 struct AUX_WRAPPER_NAME
    44 {
    45     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, value = N);
    46 // agurt, 08/mar/03: SGI MIPSpro C++ workaround, have to #ifdef because some 
    47 // other compilers (e.g. MSVC) are not particulary happy about it
    48 #if BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
    49     typedef struct AUX_WRAPPER_NAME type;
    50 #else
    51     typedef AUX_WRAPPER_NAME type;
    52 #endif
    53     typedef AUX_WRAPPER_VALUE_TYPE value_type;
    54     typedef integral_c_tag tag;
    55 
    56 // have to #ifdef here: some compilers don't like the 'N + 1' form (MSVC),
    57 // while some other don't like 'value + 1' (Borland), and some don't like
    58 // either
    59 #if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
    60  private:
    61     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)));
    62     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
    63  public:
    64     typedef AUX_WRAPPER_INST(next_value) next;
    65     typedef AUX_WRAPPER_INST(prior_value) prior;
    66 #elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
    67     || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \
    68     || BOOST_WORKAROUND(__HP_aCC, <= 53800)
    69     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next;
    70     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior;
    71 #else
    72     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value + 1)) ) next;
    73     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
    74 #endif
    75 
    76     // enables uniform function call syntax for families of overloaded 
    77     // functions that return objects of both arithmetic ('int', 'long',
    78     // 'double', etc.) and wrapped integral types (for an example, see 
    79     // "mpl/example/power.cpp")
    80     operator AUX_WRAPPER_VALUE_TYPE() const { return static_cast<AUX_WRAPPER_VALUE_TYPE>(this->value); } 
    81 };
    82 
    83 #if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
    84 template< AUX_WRAPPER_PARAMS(N) >
    85 AUX_WRAPPER_VALUE_TYPE const AUX_WRAPPER_INST(N)::value;
    86 #endif
    87 
    88 BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
    89 
    90 #undef AUX_WRAPPER_NAME
    91 #undef AUX_WRAPPER_PARAMS
    92 #undef AUX_WRAPPER_INST
    93 #undef AUX_WRAPPER_VALUE_TYPE