1313#include < boost/decimal/detail/to_decimal.hpp>
1414#include < boost/decimal/detail/shrink_significand.hpp>
1515#include < boost/decimal/detail/cmath/isfinite.hpp>
16+ #include < boost/decimal/detail/concepts.hpp>
1617#include < cstdint>
1718
1819namespace boost {
1920namespace decimal {
2021
21- template <typename DecimalType = decimal32, typename T1, typename T2>
22+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE DecimalType = decimal32, typename T1, typename T2>
2223constexpr auto equal_parts_impl (T1 lhs_sig, std::int32_t lhs_exp, bool lhs_sign,
2324 T2 rhs_sig, std::int32_t rhs_exp, bool rhs_sign) noexcept -> bool
2425{
@@ -44,7 +45,7 @@ constexpr auto equal_parts_impl(T1 lhs_sig, std::int32_t lhs_exp, bool lhs_sign,
4445 new_lhs_sig == new_rhs_sig;
4546}
4647
47- template <typename Decimal, typename Integer>
48+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, BOOST_DECIMAL_INTEGRAL Integer>
4849constexpr auto mixed_equality_impl (Decimal lhs, Integer rhs) noexcept
4950 -> std::enable_if_t<(detail::is_decimal_floating_point_v<Decimal> && detail::is_integral_v<Integer>), bool>
5051{
@@ -68,7 +69,7 @@ constexpr auto mixed_equality_impl(Decimal lhs, Integer rhs) noexcept
6869 rhs_significand, INT32_C (0 ), rhs_isneg);
6970}
7071
71- template <typename Decimal1, typename Decimal2>
72+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
7273constexpr auto mixed_decimal_equality_impl (Decimal1 lhs, Decimal2 rhs) noexcept
7374 -> std::enable_if_t<(detail::is_decimal_floating_point_v<Decimal1> &&
7475 detail::is_decimal_floating_point_v<Decimal2>), bool>
@@ -87,23 +88,23 @@ constexpr auto mixed_decimal_equality_impl(Decimal1 lhs, Decimal2 rhs) noexcept
8788 return new_lhs == new_rhs;
8889}
8990
90- template <typename Decimal1, typename Decimal2>
91+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
9192constexpr auto operator ==(Decimal1 lhs, Decimal2 rhs) noexcept
9293 -> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
9394 detail::is_decimal_floating_point_v<Decimal2>), bool >
9495{
9596 return mixed_decimal_equality_impl (lhs, rhs);
9697}
9798
98- template <typename Decimal1, typename Decimal2>
99+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
99100constexpr auto operator !=(Decimal1 lhs, Decimal2 rhs) noexcept
100101 -> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
101102 detail::is_decimal_floating_point_v<Decimal2>), bool >
102103{
103104 return !(mixed_decimal_equality_impl (lhs, rhs));
104105}
105106
106- template <typename DecimalType = decimal32, typename T1, typename T2>
107+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE DecimalType = decimal32, typename T1, typename T2>
107108constexpr auto less_parts_impl (T1 lhs_sig, std::int32_t lhs_exp, bool lhs_sign,
108109 T2 rhs_sig, std::int32_t rhs_exp, bool rhs_sign) noexcept -> bool
109110{
@@ -163,7 +164,7 @@ constexpr auto less_parts_impl(T1 lhs_sig, std::int32_t lhs_exp, bool lhs_sign,
163164 }
164165}
165166
166- template <typename Decimal, typename Integer>
167+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, BOOST_DECIMAL_INTEGRAL Integer>
167168constexpr auto less_impl (Decimal lhs, Integer rhs) noexcept
168169 -> std::enable_if_t<(detail::is_decimal_floating_point_v<Decimal> && detail::is_integral_v<Integer>), bool>
169170{
@@ -209,7 +210,7 @@ constexpr auto less_impl(Decimal lhs, Integer rhs) noexcept
209210 rhs_significand, INT32_C (0 ), rhs_sign);
210211}
211212
212- template <typename Decimal1, typename Decimal2>
213+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
213214constexpr auto mixed_decimal_less_impl (Decimal1 lhs, Decimal2 rhs) noexcept
214215 -> std::enable_if_t<(detail::is_decimal_floating_point_v<Decimal1> &&
215216 detail::is_decimal_floating_point_v<Decimal2>), bool>
@@ -240,15 +241,15 @@ constexpr auto mixed_decimal_less_impl(Decimal1 lhs, Decimal2 rhs) noexcept
240241 rhs.full_significand (), rhs.biased_exponent (), rhs.isneg ());
241242}
242243
243- template <typename Decimal1, typename Decimal2>
244+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
244245constexpr auto operator <(Decimal1 lhs, Decimal2 rhs) noexcept
245246 -> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
246247 detail::is_decimal_floating_point_v<Decimal2>), bool >
247248{
248249 return mixed_decimal_less_impl (lhs, rhs);
249250}
250251
251- template <typename Decimal1, typename Decimal2>
252+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
252253constexpr auto operator <=(Decimal1 lhs, Decimal2 rhs) noexcept
253254 -> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
254255 detail::is_decimal_floating_point_v<Decimal2>), bool >
@@ -261,15 +262,15 @@ constexpr auto operator<=(Decimal1 lhs, Decimal2 rhs) noexcept
261262 return !(rhs < lhs);
262263}
263264
264- template <typename Decimal1, typename Decimal2>
265+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
265266constexpr auto operator >(Decimal1 lhs, Decimal2 rhs) noexcept
266267 -> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
267268 detail::is_decimal_floating_point_v<Decimal2>), bool >
268269{
269270 return rhs < lhs;
270271}
271272
272- template <typename Decimal1, typename Decimal2>
273+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
273274constexpr auto operator >=(Decimal1 lhs, Decimal2 rhs) noexcept
274275 -> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
275276 detail::is_decimal_floating_point_v<Decimal2>), bool >
@@ -284,7 +285,7 @@ constexpr auto operator>=(Decimal1 lhs, Decimal2 rhs) noexcept
284285
285286#ifdef BOOST_DECIMAL_HAS_SPACESHIP_OPERATOR
286287
287- template <typename Decimal1, typename Decimal2>
288+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
288289constexpr auto operator <=>(Decimal1 lhs, Decimal2 rhs) noexcept
289290 -> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
290291 detail::is_decimal_floating_point_v<Decimal2>), std::partial_ordering>
0 commit comments