mirror of
https://github.com/boostorg/integer.git
synced 2025-07-30 20:57:13 +02:00
Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Process #ifndef...#else...#endif blocks. [SVN r86245]
This commit is contained in:
committed by
Peter Dimov
parent
9f43b6a7d6
commit
b70c89a3ff
@ -23,7 +23,6 @@ namespace math
|
|||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
|
||||||
// Build GCD with Euclid's recursive algorithm
|
// Build GCD with Euclid's recursive algorithm
|
||||||
template < static_gcd_type Value1, static_gcd_type Value2 >
|
template < static_gcd_type Value1, static_gcd_type Value2 >
|
||||||
struct static_gcd_helper_t
|
struct static_gcd_helper_t
|
||||||
@ -54,48 +53,7 @@ namespace detail
|
|||||||
{
|
{
|
||||||
BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 );
|
BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 );
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
// Use inner class template workaround from Peter Dimov
|
|
||||||
template < static_gcd_type Value1 >
|
|
||||||
struct static_gcd_helper2_t
|
|
||||||
{
|
|
||||||
template < static_gcd_type Value2 >
|
|
||||||
struct helper
|
|
||||||
{
|
|
||||||
BOOST_STATIC_CONSTANT( static_gcd_type, value
|
|
||||||
= static_gcd_helper2_t<Value2>::BOOST_NESTED_TEMPLATE
|
|
||||||
helper<Value1 % Value2>::value );
|
|
||||||
};
|
|
||||||
|
|
||||||
template < >
|
|
||||||
struct helper< 0UL >
|
|
||||||
{
|
|
||||||
BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 );
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Special case
|
|
||||||
template < >
|
|
||||||
struct static_gcd_helper2_t< 0UL >
|
|
||||||
{
|
|
||||||
template < static_gcd_type Value2 >
|
|
||||||
struct helper
|
|
||||||
{
|
|
||||||
BOOST_STATIC_CONSTANT( static_gcd_type, value = Value2 );
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Build the GCD from the above template(s)
|
|
||||||
template < static_gcd_type Value1, static_gcd_type Value2 >
|
|
||||||
struct static_gcd_helper_t
|
|
||||||
{
|
|
||||||
BOOST_STATIC_CONSTANT( static_gcd_type, value
|
|
||||||
= static_gcd_helper2_t<Value1>::BOOST_NESTED_TEMPLATE
|
|
||||||
helper<Value2>::value );
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
|
||||||
// Build the LCM from the GCD
|
// Build the LCM from the GCD
|
||||||
template < static_gcd_type Value1, static_gcd_type Value2 >
|
template < static_gcd_type Value1, static_gcd_type Value2 >
|
||||||
struct static_lcm_helper_t
|
struct static_lcm_helper_t
|
||||||
@ -112,47 +70,6 @@ namespace detail
|
|||||||
{
|
{
|
||||||
BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL );
|
BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL );
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
// Adapt GCD's inner class template workaround for LCM
|
|
||||||
template < static_gcd_type Value1 >
|
|
||||||
struct static_lcm_helper2_t
|
|
||||||
{
|
|
||||||
template < static_gcd_type Value2 >
|
|
||||||
struct helper
|
|
||||||
{
|
|
||||||
typedef static_gcd_helper_t<Value1, Value2> gcd_type;
|
|
||||||
|
|
||||||
BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1
|
|
||||||
/ gcd_type::value * Value2 );
|
|
||||||
};
|
|
||||||
|
|
||||||
template < >
|
|
||||||
struct helper< 0UL >
|
|
||||||
{
|
|
||||||
BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL );
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Special case
|
|
||||||
template < >
|
|
||||||
struct static_lcm_helper2_t< 0UL >
|
|
||||||
{
|
|
||||||
template < static_gcd_type Value2 >
|
|
||||||
struct helper
|
|
||||||
{
|
|
||||||
BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL );
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Build the LCM from the above template(s)
|
|
||||||
template < static_gcd_type Value1, static_gcd_type Value2 >
|
|
||||||
struct static_lcm_helper_t
|
|
||||||
{
|
|
||||||
BOOST_STATIC_CONSTANT( static_gcd_type, value
|
|
||||||
= static_lcm_helper2_t<Value1>::BOOST_NESTED_TEMPLATE
|
|
||||||
helper<Value2>::value );
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
|
@ -222,7 +222,6 @@ namespace detail
|
|||||||
|
|
||||||
// Function objects to find the best way of computing GCD or LCM
|
// Function objects to find the best way of computing GCD or LCM
|
||||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
|
||||||
template < typename T, bool IsSpecialized, bool IsSigned >
|
template < typename T, bool IsSpecialized, bool IsSigned >
|
||||||
struct gcd_optimal_evaluator_helper_t
|
struct gcd_optimal_evaluator_helper_t
|
||||||
{
|
{
|
||||||
@ -240,40 +239,6 @@ namespace detail
|
|||||||
return gcd_integer( a, 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<IsSpecialized, IsSigned>
|
|
||||||
::BOOST_NESTED_TEMPLATE helper<T>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template < typename T >
|
template < typename T >
|
||||||
struct gcd_optimal_evaluator
|
struct gcd_optimal_evaluator
|
||||||
@ -348,7 +313,6 @@ namespace detail
|
|||||||
#undef BOOST_PRIVATE_GCD_SF
|
#undef BOOST_PRIVATE_GCD_SF
|
||||||
|
|
||||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
|
||||||
template < typename T, bool IsSpecialized, bool IsSigned >
|
template < typename T, bool IsSpecialized, bool IsSigned >
|
||||||
struct lcm_optimal_evaluator_helper_t
|
struct lcm_optimal_evaluator_helper_t
|
||||||
{
|
{
|
||||||
@ -366,40 +330,6 @@ namespace detail
|
|||||||
return lcm_integer( a, 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<IsSpecialized, IsSigned>
|
|
||||||
::BOOST_NESTED_TEMPLATE helper<T>
|
|
||||||
{
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template < typename T >
|
template < typename T >
|
||||||
struct lcm_optimal_evaluator
|
struct lcm_optimal_evaluator
|
||||||
|
Reference in New Issue
Block a user