bitand.hpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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/bitand.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 bitand_impl
  18. : if_c<
  19. ( tag1_ > tag2_ )
  20. , aux::cast2nd_impl< bitand_impl< Tag1,Tag1 >,Tag1, Tag2 >
  21. , aux::cast1st_impl< bitand_impl< Tag2,Tag2 >,Tag1, Tag2 >
  22. >::type
  23. {
  24. };
  25. /// for Digital Mars C++/compilers with no CTPS/TTP support
  26. template<> struct bitand_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 bitand_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 bitand_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 bitand_tag
  51. : tag< T,na >
  52. {
  53. };
  54. /// forward declaration
  55. template<
  56. typename BOOST_MPL_AUX_NA_PARAM(N1)
  57. , typename BOOST_MPL_AUX_NA_PARAM(N2)
  58. >
  59. struct bitand_2;
  60. template<
  61. typename BOOST_MPL_AUX_NA_PARAM(N1)
  62. , typename BOOST_MPL_AUX_NA_PARAM(N2)
  63. , typename N3 = na, typename N4 = na, typename N5 = na
  64. >
  65. struct bitand_
  66. : aux::msvc_eti_base< typename if_<
  67. is_na<N3>
  68. , bitand_2< N1,N2 >
  69. , bitand_<
  70. bitand_2< N1,N2 >
  71. , N3, N4, N5
  72. >
  73. >::type
  74. >
  75. {
  76. BOOST_MPL_AUX_LAMBDA_SUPPORT(
  77. 5
  78. , bitand_
  79. , ( N1, N2, N3, N4, N5 )
  80. )
  81. };
  82. template<
  83. typename N1
  84. , typename N2
  85. >
  86. struct bitand_2
  87. : aux::msvc_eti_base< typename apply_wrap2<
  88. bitand_impl<
  89. typename bitand_tag<N1>::type
  90. , typename bitand_tag<N2>::type
  91. >
  92. , N1
  93. , N2
  94. >::type >::type
  95. {
  96. BOOST_MPL_AUX_LAMBDA_SUPPORT(2, bitand_2, (N1, N2))
  97. };
  98. BOOST_MPL_AUX_NA_SPEC2(2, 5, bitand_)
  99. }}
  100. namespace boost { namespace mpl {
  101. namespace aux {
  102. template< typename T, T n1, T n2 >
  103. struct bitand_wknd
  104. {
  105. BOOST_STATIC_CONSTANT(T, value = (n1 & n2));
  106. typedef integral_c< T,value > type;
  107. };
  108. }
  109. template<>
  110. struct bitand_impl< integral_c_tag,integral_c_tag >
  111. {
  112. template< typename N1, typename N2 > struct apply
  113. : aux::bitand_wknd<
  114. typename aux::largest_int<
  115. typename N1::value_type
  116. , typename N2::value_type
  117. >::type
  118. , N1::value
  119. , N2::value
  120. >::type
  121. {
  122. };
  123. };
  124. }}