bitand.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. >
  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<> 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. {
  52. typedef typename T::tag type;
  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. : 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. BOOST_MPL_AUX_LAMBDA_SUPPORT(
  76. 5
  77. , bitand_
  78. , ( N1, N2, N3, N4, N5 )
  79. )
  80. };
  81. template<
  82. typename N1
  83. , typename N2
  84. >
  85. struct bitand_2
  86. : bitand_impl<
  87. typename bitand_tag<N1>::type
  88. , typename bitand_tag<N2>::type
  89. >::template apply< N1,N2 >::type
  90. {
  91. BOOST_MPL_AUX_LAMBDA_SUPPORT(2, bitand_2, (N1, N2))
  92. };
  93. BOOST_MPL_AUX_NA_SPEC2(2, 5, bitand_)
  94. }}
  95. namespace boost { namespace mpl {
  96. template<>
  97. struct bitand_impl< integral_c_tag,integral_c_tag >
  98. {
  99. template< typename N1, typename N2 > struct apply
  100. : integral_c<
  101. typename aux::largest_int<
  102. typename N1::value_type
  103. , typename N2::value_type
  104. >::type
  105. , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value
  106. & BOOST_MPL_AUX_VALUE_WKND(N2)::value
  107. )
  108. >
  109. {
  110. };
  111. };
  112. }}