1212#include < type_traits>
1313#include < limits>
1414#include < boost/math/tools/is_constant_evaluated.hpp>
15+ #include < boost/math/concepts/concepts.hpp>
1516#include < boost/math/ccmath/isnan.hpp>
1617#include < boost/math/ccmath/isinf.hpp>
1718
@@ -27,7 +28,7 @@ namespace boost::math::ccmath {
2728
2829namespace detail {
2930
30- template <typename T>
31+ template <BOOST_MATH_ARBITRARY_SIGNED_ARITHMETIC T>
3132inline constexpr T abs_impl (T x) noexcept
3233{
3334 return boost::math::ccmath::isnan (x) ? std::numeric_limits<T>::quiet_NaN () :
@@ -40,6 +41,7 @@ inline constexpr T abs_impl(T x) noexcept
4041} // Namespace detail
4142
4243template <typename T, std::enable_if_t <!std::is_unsigned_v<T>, bool > = true >
44+ BOOST_MATH_REQUIRES (BOOST_MATH_ARBITRARY_SIGNED_ARITHMETIC, T)
4345inline constexpr T abs (T x) noexcept
4446{
4547 if (BOOST_MATH_IS_CONSTANT_EVALUATED (x))
@@ -56,6 +58,7 @@ inline constexpr T abs(T x) noexcept
5658// If abs() is called with an argument of type X for which is_unsigned_v<X> is true and if X
5759// cannot be converted to int by integral promotion (7.3.7), the program is ill-formed.
5860template <typename T, std::enable_if_t <std::is_unsigned_v<T>, bool > = true >
61+ BOOST_MATH_REQUIRES (BOOST_MATH_ARBITRARY_UNSIGNED_ARITHMETIC, T)
5962inline constexpr T abs (T x) noexcept
6063{
6164 if constexpr (std::is_convertible_v<T, int >)
0 commit comments