shift_op.hpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
  2. // Copyright Aleksey Gurtovoy 2000-2004
  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. // $Id$
  10. // $Date$
  11. // $Revision$
  12. #if !defined(BOOST_MPL_PREPROCESSING_MODE)
  13. # include <boost/mpl/integral_c.hpp>
  14. # include <boost/mpl/aux_/value_wknd.hpp>
  15. #endif
  16. #if !defined(AUX778076_OP_PREFIX)
  17. # define AUX778076_OP_PREFIX AUX778076_OP_NAME
  18. #endif
  19. #define AUX778076_OP_ARITY 2
  20. #include <boost/mpl/aux_/numeric_op.hpp>
  21. #include <boost/mpl/aux_/config/static_constant.hpp>
  22. #include <boost/mpl/aux_/config/use_preprocessed.hpp>
  23. #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
  24. && !defined(BOOST_MPL_PREPROCESSING_MODE)
  25. # define BOOST_MPL_PREPROCESSED_HEADER AUX778076_OP_PREFIX.hpp
  26. # include <boost/mpl/aux_/include_preprocessed.hpp>
  27. #else
  28. # include <boost/mpl/aux_/config/integral.hpp>
  29. # include <boost/preprocessor/cat.hpp>
  30. namespace boost { namespace mpl {
  31. #if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC)
  32. namespace aux {
  33. template< typename T, typename Shift, T n, Shift s >
  34. struct BOOST_PP_CAT(AUX778076_OP_PREFIX,_wknd)
  35. {
  36. BOOST_STATIC_CONSTANT(T, value = (n AUX778076_OP_TOKEN s));
  37. typedef integral_c<T,value> type;
  38. };
  39. }
  40. #endif
  41. template<>
  42. struct AUX778076_OP_IMPL_NAME<integral_c_tag,integral_c_tag>
  43. {
  44. template< typename N, typename S > struct apply
  45. #if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC)
  46. : integral_c<
  47. typename N::value_type
  48. , ( BOOST_MPL_AUX_VALUE_WKND(N)::value
  49. AUX778076_OP_TOKEN BOOST_MPL_AUX_VALUE_WKND(S)::value
  50. )
  51. >
  52. #else
  53. : aux::BOOST_PP_CAT(AUX778076_OP_PREFIX,_wknd)<
  54. typename N::value_type
  55. , typename S::value_type
  56. , N::value
  57. , S::value
  58. >::type
  59. #endif
  60. {
  61. };
  62. };
  63. }}
  64. #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
  65. #undef AUX778076_OP_TAG_NAME
  66. #undef AUX778076_OP_IMPL_NAME
  67. #undef AUX778076_OP_ARITY
  68. #undef AUX778076_OP_PREFIX
  69. #undef AUX778076_OP_NAME
  70. #undef AUX778076_OP_TOKEN