shift_right.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // Copyright Aleksey Gurtovoy 2000-2004
  2. // Copyright Jaap Suter 2003
  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. // Preprocessed version of "boost/mpl/shift_right.hpp" header
  9. // -- DO NOT modify by hand!
  10. namespace boost { namespace mpl {
  11. template<
  12. typename Tag1
  13. , typename Tag2
  14. , BOOST_MPL_AUX_NTTP_DECL(int, tag1_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag1)::value
  15. , BOOST_MPL_AUX_NTTP_DECL(int, tag2_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag2)::value
  16. >
  17. struct shift_right_impl
  18. : if_c<
  19. ( tag1_ > tag2_ )
  20. , aux::cast2nd_impl< shift_right_impl< Tag1,Tag1 >,Tag1, Tag2 >
  21. , aux::cast1st_impl< shift_right_impl< Tag2,Tag2 >,Tag1, Tag2 >
  22. >::type
  23. {
  24. };
  25. /// for Digital Mars C++/compilers with no CTPS/TTP support
  26. template<> struct shift_right_impl< na,na >
  27. {
  28. template< typename U1, typename U2 > struct apply
  29. {
  30. typedef apply type;
  31. BOOST_STATIC_CONSTANT(int, value = 0);
  32. };
  33. };
  34. template<> struct shift_right_impl< na,integral_c_tag >
  35. {
  36. template< typename U1, typename U2 > struct apply
  37. {
  38. typedef apply type;
  39. BOOST_STATIC_CONSTANT(int, value = 0);
  40. };
  41. };
  42. template<> struct shift_right_impl< integral_c_tag,na >
  43. {
  44. template< typename U1, typename U2 > struct apply
  45. {
  46. typedef apply type;
  47. BOOST_STATIC_CONSTANT(int, value = 0);
  48. };
  49. };
  50. template< typename T > struct shift_right_tag
  51. {
  52. typedef typename T::tag type;
  53. };
  54. template<
  55. typename BOOST_MPL_AUX_NA_PARAM(N1)
  56. , typename BOOST_MPL_AUX_NA_PARAM(N2)
  57. >
  58. struct shift_right
  59. : aux::msvc_eti_base< typename apply_wrap2<
  60. shift_right_impl<
  61. typename shift_right_tag<N1>::type
  62. , typename shift_right_tag<N2>::type
  63. >
  64. , N1
  65. , N2
  66. >::type >::type
  67. {
  68. BOOST_MPL_AUX_LAMBDA_SUPPORT(2, shift_right, (N1, N2))
  69. };
  70. BOOST_MPL_AUX_NA_SPEC2(2, 2, shift_right)
  71. }}
  72. namespace boost { namespace mpl {
  73. namespace aux {
  74. template< typename T, typename Shift, T n, Shift s >
  75. struct shift_right_wknd
  76. {
  77. BOOST_STATIC_CONSTANT(T, value = (n >> s));
  78. typedef integral_c< T,value > type;
  79. };
  80. }
  81. template<>
  82. struct shift_right_impl< integral_c_tag,integral_c_tag >
  83. {
  84. template< typename N, typename S > struct apply
  85. : aux::shift_right_wknd<
  86. typename N::value_type
  87. , typename S::value_type
  88. , N::value
  89. , S::value
  90. >::type
  91. {
  92. };
  93. };
  94. }}