times.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. // Copyright Aleksey Gurtovoy 2000-2004
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Preprocessed version of "boost/mpl/times.hpp" header
  8. // -- DO NOT modify by hand!
  9. namespace boost { namespace mpl {
  10. template<
  11. typename Tag1
  12. , typename Tag2
  13. >
  14. struct times_impl
  15. : if_c<
  16. ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
  17. > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
  18. )
  19. , aux::cast2nd_impl< times_impl< Tag1,Tag1 >,Tag1, Tag2 >
  20. , aux::cast1st_impl< times_impl< Tag2,Tag2 >,Tag1, Tag2 >
  21. >::type
  22. {
  23. };
  24. /// for Digital Mars C++/compilers with no CTPS/TTP support
  25. template<> struct times_impl< na,na >
  26. {
  27. template< typename U1, typename U2 > struct apply
  28. {
  29. typedef apply type;
  30. BOOST_STATIC_CONSTANT(int, value = 0);
  31. };
  32. };
  33. template< typename Tag > struct times_impl< na,Tag >
  34. {
  35. template< typename U1, typename U2 > struct apply
  36. {
  37. typedef apply type;
  38. BOOST_STATIC_CONSTANT(int, value = 0);
  39. };
  40. };
  41. template< typename Tag > struct times_impl< Tag,na >
  42. {
  43. template< typename U1, typename U2 > struct apply
  44. {
  45. typedef apply type;
  46. BOOST_STATIC_CONSTANT(int, value = 0);
  47. };
  48. };
  49. template< typename T > struct times_tag
  50. {
  51. typedef typename T::tag type;
  52. };
  53. template<
  54. typename BOOST_MPL_AUX_NA_PARAM(N1)
  55. , typename BOOST_MPL_AUX_NA_PARAM(N2)
  56. , typename N3 = na, typename N4 = na, typename N5 = na
  57. >
  58. struct times
  59. : times< times< times< times< N1,N2 >, N3>, N4>, N5>
  60. {
  61. BOOST_MPL_AUX_LAMBDA_SUPPORT(
  62. 5
  63. , times
  64. , ( N1, N2, N3, N4, N5 )
  65. )
  66. };
  67. template<
  68. typename N1, typename N2, typename N3, typename N4
  69. >
  70. struct times< N1,N2,N3,N4,na >
  71. : times< times< times< N1,N2 >, N3>, N4>
  72. {
  73. BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
  74. 5
  75. , times
  76. , ( N1, N2, N3, N4, na )
  77. )
  78. };
  79. template<
  80. typename N1, typename N2, typename N3
  81. >
  82. struct times< N1,N2,N3,na,na >
  83. : times< times< N1,N2 >, N3>
  84. {
  85. BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
  86. 5
  87. , times
  88. , ( N1, N2, N3, na, na )
  89. )
  90. };
  91. template<
  92. typename N1, typename N2
  93. >
  94. struct times< N1,N2,na,na,na >
  95. : times_impl<
  96. typename times_tag<N1>::type
  97. , typename times_tag<N2>::type
  98. >::template apply< N1,N2 >::type
  99. {
  100. BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
  101. 5
  102. , times
  103. , ( N1, N2, na, na, na )
  104. )
  105. };
  106. BOOST_MPL_AUX_NA_SPEC2(2, 5, times)
  107. }}
  108. namespace boost { namespace mpl {
  109. namespace aux {
  110. template< typename T, T n1, T n2 >
  111. struct times_wknd
  112. {
  113. BOOST_STATIC_CONSTANT(T, value = (n1 * n2));
  114. typedef integral_c< T,value > type;
  115. };
  116. }
  117. template<>
  118. struct times_impl< integral_c_tag,integral_c_tag >
  119. {
  120. template< typename N1, typename N2 > struct apply
  121. : aux::times_wknd<
  122. typename aux::largest_int<
  123. typename N1::value_type
  124. , typename N2::value_type
  125. >::type
  126. , N1::value
  127. , N2::value
  128. >::type
  129. {
  130. };
  131. };
  132. }}