BVB Source Codes

mars Show integral_wrapper.hpp Source code

Return Download mars: download integral_wrapper.hpp Source code - Download mars Source code - Type:.hpp
  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. // $Id$
  11. // $Date$
  12. // $Revision$
  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) && (BOOST_WORKAROUND(__hpxstd98, != 1)))
  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.     BOOST_CONSTEXPR 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
  94.  
downloadintegral_wrapper.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top