bitand.hpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 the main "bitand.hpp" header
  9. // -- DO NOT modify by hand!
  10. namespace boost { namespace mpl {
  11. template<
  12. typename Tag1
  13. , typename Tag2
  14. >
  15. struct bitand_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< 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< typename Tag > struct bitand_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 bitand_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 bitand_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. , typename N3 = na, typename N4 = na, typename N5 = na
  58. >
  59. struct bitand_
  60. : bitand_< bitand_< bitand_< bitand_< N1,N2 >, N3>, N4>, N5>
  61. {
  62. BOOST_MPL_AUX_LAMBDA_SUPPORT(
  63. 5
  64. , bitand_
  65. , ( N1, N2, N3, N4, N5 )
  66. )
  67. };
  68. template<
  69. typename N1, typename N2, typename N3, typename N4
  70. >
  71. struct bitand_< N1,N2,N3,N4,na >
  72. : bitand_< bitand_< bitand_< N1,N2 >, N3>, N4>
  73. {
  74. BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
  75. 5
  76. , bitand_
  77. , ( N1, N2, N3, N4, na )
  78. )
  79. };
  80. template<
  81. typename N1, typename N2, typename N3
  82. >
  83. struct bitand_< N1,N2,N3,na,na >
  84. : bitand_< bitand_< N1,N2 >, N3>
  85. {
  86. BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
  87. 5
  88. , bitand_
  89. , ( N1, N2, N3, na, na )
  90. )
  91. };
  92. template<
  93. typename N1, typename N2
  94. >
  95. struct bitand_< N1,N2,na,na,na >
  96. : bitand_impl<
  97. typename bitand_tag<N1>::type
  98. , typename bitand_tag<N2>::type
  99. >::template apply< N1,N2 >::type
  100. {
  101. BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
  102. 5
  103. , bitand_
  104. , ( N1, N2, na, na, na )
  105. )
  106. };
  107. BOOST_MPL_AUX_NA_SPEC2(2, 5, bitand_)
  108. }}
  109. namespace boost { namespace mpl {
  110. template<>
  111. struct bitand_impl< integral_c_tag,integral_c_tag >
  112. {
  113. template< typename N1, typename N2 > struct apply
  114. : integral_c<
  115. typename aux::largest_int<
  116. typename N1::value_type
  117. , typename N2::value_type
  118. >::type
  119. , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value
  120. & BOOST_MPL_AUX_VALUE_WKND(N2)::value
  121. )
  122. >
  123. {
  124. };
  125. };
  126. }}