diff --git a/include/boost/math/common_factor.hpp b/include/boost/math/common_factor.hpp index af984f9..0db82bc 100644 --- a/include/boost/math/common_factor.hpp +++ b/include/boost/math/common_factor.hpp @@ -134,7 +134,8 @@ namespace detail struct static_gcd_helper_t { BOOST_STATIC_CONSTANT( unsigned long, value - = static_gcd_helper2_t::helper::value ); + = static_gcd_helper2_t::BOOST_NESTED_TEMPLATE + helper::value ); }; #endif @@ -192,7 +193,8 @@ namespace detail struct static_lcm_helper_t { BOOST_STATIC_CONSTANT( unsigned long, value - = static_lcm_helper2_t::helper::value ); + = static_lcm_helper2_t::BOOST_NESTED_TEMPLATE + helper::value ); }; #endif @@ -276,8 +278,9 @@ namespace detail } // Function objects to find the best way of computing GCD or LCM +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template < typename T, bool IsSpecialized, bool IsSigned > - struct gcd_optimal_evaluator_helper + struct gcd_optimal_evaluator_helper_t { T operator ()( T const &a, T const &b ) { @@ -286,13 +289,47 @@ namespace detail }; template < typename T > - struct gcd_optimal_evaluator_helper< T, true, true > + struct gcd_optimal_evaluator_helper_t< T, true, true > { T operator ()( T const &a, T const &b ) { return gcd_integer( a, b ); } }; +#else + template < bool IsSpecialized, bool IsSigned > + struct gcd_optimal_evaluator_helper2_t + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return gcd_euclidean( a, b ); + } + }; + }; + + template < > + struct gcd_optimal_evaluator_helper2_t< true, true > + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return gcd_integer( a, b ); + } + }; + }; + + template < typename T, bool IsSpecialized, bool IsSigned > + struct gcd_optimal_evaluator_helper_t + : gcd_optimal_evaluator_helper2_t + ::BOOST_NESTED_TEMPLATE helper + { + }; +#endif template < typename T > struct gcd_optimal_evaluator @@ -301,8 +338,8 @@ namespace detail { typedef ::std::numeric_limits limits_type; - typedef gcd_optimal_evaluator_helper helper_type; + typedef gcd_optimal_evaluator_helper_t helper_type; helper_type solver; @@ -310,8 +347,9 @@ namespace detail } }; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template < typename T, bool IsSpecialized, bool IsSigned > - struct lcm_optimal_evaluator_helper + struct lcm_optimal_evaluator_helper_t { T operator ()( T const &a, T const &b ) { @@ -320,13 +358,47 @@ namespace detail }; template < typename T > - struct lcm_optimal_evaluator_helper< T, true, true > + struct lcm_optimal_evaluator_helper_t< T, true, true > { T operator ()( T const &a, T const &b ) { return lcm_integer( a, b ); } }; +#else + template < bool IsSpecialized, bool IsSigned > + struct lcm_optimal_evaluator_helper2_t + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return lcm_euclidean( a, b ); + } + }; + }; + + template < > + struct lcm_optimal_evaluator_helper2_t< true, true > + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return lcm_integer( a, b ); + } + }; + }; + + template < typename T, bool IsSpecialized, bool IsSigned > + struct lcm_optimal_evaluator_helper_t + : lcm_optimal_evaluator_helper2_t + ::BOOST_NESTED_TEMPLATE helper + { + }; +#endif template < typename T > struct lcm_optimal_evaluator @@ -335,8 +407,8 @@ namespace detail { typedef ::std::numeric_limits limits_type; - typedef lcm_optimal_evaluator_helper helper_type; + typedef lcm_optimal_evaluator_helper_t helper_type; helper_type solver;