Ticket #7075: 7075.patch
File 7075.patch, 3.6 KB (added by , 10 years ago) |
---|
-
detail/mpl/gcd.hpp
20 20 #include <boost/mpl/aux_/config/eti.hpp> 21 21 #include <boost/mpl/aux_/config/integral.hpp> 22 22 #include <boost/mpl/aux_/config/static_constant.hpp> 23 #include <boost/mpl/aux_/config/dependent_nttp.hpp> 24 #include <boost/cstdint.hpp> 23 25 24 26 #if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) \ 25 27 && !defined(BOOST_MPL_PREPROCESSING_MODE) \ … … 65 67 { 66 68 }; 67 69 70 // Workaround for error: the type of partial specialization template parameter constant "n2" 71 // depends on another template parameter 72 // Note: this solution could be wrong for n1 or n2 = [2**63 .. 2**64-1] 73 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) 74 68 75 namespace aux { 76 template< typename T1, boost::intmax_t n1, bool n1_is_0 77 , typename T2, boost::intmax_t n2, bool n2_is_0 > 78 struct gcd_aux 79 : gcd_aux<T2, n2, n2==0, T1, (n1 % n2), (n1 % n2)==0> 80 {}; 81 82 template <typename T1, boost::intmax_t n1, typename T2, boost::intmax_t n2> 83 struct gcd_aux<T1, n1, false, T2, n2, true> : integral_c<T1, n1> 84 {}; 85 86 template <typename T1, boost::intmax_t n1, typename T2, boost::intmax_t n2, bool C> 87 struct gcd_aux<T1, n1, true, T2, n2, C> : integral_c<T2, n2> 88 {}; 89 } 90 91 #else // defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) 92 93 namespace aux { 69 94 template< typename T1, T1 n1, bool n1_is_0, typename T2, T2 n2, bool n2_is_0 > 70 95 struct gcd_aux 71 96 … … 84 109 {}; 85 110 } 86 111 112 #endif // defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) 113 87 114 template<> 88 115 struct gcd_impl<integral_c_tag, integral_c_tag> 89 116 { -
detail/mpl/lcm.hpp
20 20 #include <boost/mpl/aux_/config/eti.hpp> 21 21 #include <boost/mpl/aux_/config/integral.hpp> 22 22 #include <boost/mpl/aux_/config/static_constant.hpp> 23 #include <boost/mpl/aux_/config/dependent_nttp.hpp> 24 #include <boost/cstdint.hpp> 23 25 24 26 #if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) \ 25 27 && !defined(BOOST_MPL_PREPROCESSING_MODE) \ … … 66 68 }; 67 69 68 70 71 // Workaround for error: the type of partial specialization template parameter constant "n2" 72 // depends on another template parameter 73 // Note: this solution could be wrong for n1 or n2 = [2**63 .. 2**64-1] 74 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) 75 69 76 namespace aux { 77 template< typename T1, boost::intmax_t n1, bool n1_is_0 78 , typename T2, boost::intmax_t n2, bool n2_is_0 > 79 struct lcm_aux 80 : abs<integral_c< typename aux::largest_int<T1, T2>::type, 81 ( n1 / gcd<integral_c<T1,n1>, integral_c<T2,n2> >::value * n2 ) 82 > > 83 {}; 84 85 template <typename T1, boost::intmax_t n1, typename T2, boost::intmax_t n2> 86 struct lcm_aux<T1, n1, false, T2, n2, true> : integral_c<T2, 0> 87 {}; 88 89 template <typename T1, boost::intmax_t n1, typename T2, boost::intmax_t n2, bool C> 90 struct lcm_aux<T1, n1, true, T2, n2, C> : integral_c<T1, 0> 91 {}; 92 } 93 94 #else // defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) 95 96 namespace aux { 70 97 template< typename T1, T1 n1, bool n1_is_0, typename T2, T2 n2, bool n2_is_0 > 71 98 struct lcm_aux 72 99 … … 84 111 {}; 85 112 } 86 113 114 #endif // defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) 115 87 116 template<> 88 117 struct lcm_impl<integral_c_tag, integral_c_tag> 89 118 {