]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/mpl/aux_/integral_wrapper.hpp
Logo AND Algorithmique Numérique Distribuée

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