shift_right.hpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. >
  15. struct shift_right_impl
  16. : if_c<
  17. ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
  18. > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
  19. )
  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< typename Tag > struct shift_right_impl< na,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< typename Tag > struct shift_right_impl< 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. : shift_right_impl<
  60. typename shift_right_tag<N1>::type
  61. , typename shift_right_tag<N2>::type
  62. >::template apply< N1,N2 >::type
  63. {
  64. BOOST_MPL_AUX_LAMBDA_SUPPORT(2, shift_right, (N1, N2))
  65. };
  66. BOOST_MPL_AUX_NA_SPEC2(2, 2, shift_right)
  67. }}
  68. namespace boost { namespace mpl {
  69. namespace aux {
  70. template< typename T, typename Shift, T n, Shift s >
  71. struct shift_right_wknd
  72. {
  73. BOOST_STATIC_CONSTANT(T, value = (n >> s));
  74. typedef integral_c< T,value > type;
  75. };
  76. }
  77. template<>
  78. struct shift_right_impl< integral_c_tag,integral_c_tag >
  79. {
  80. template< typename N, typename S > struct apply
  81. : aux::shift_right_wknd<
  82. typename N::value_type
  83. , typename S::value_type
  84. , N::value
  85. , S::value
  86. >::type
  87. {
  88. };
  89. };
  90. }}