13
13
#include < boost/decimal/detail/to_decimal.hpp>
14
14
#include < boost/decimal/detail/shrink_significand.hpp>
15
15
#include < boost/decimal/detail/cmath/isfinite.hpp>
16
+ #include < boost/decimal/detail/concepts.hpp>
16
17
#include < cstdint>
17
18
18
19
namespace boost {
19
20
namespace decimal {
20
21
21
- template <typename DecimalType = decimal32, typename T1, typename T2>
22
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE DecimalType = decimal32, typename T1, typename T2>
22
23
constexpr auto equal_parts_impl (T1 lhs_sig, std::int32_t lhs_exp, bool lhs_sign,
23
24
T2 rhs_sig, std::int32_t rhs_exp, bool rhs_sign) noexcept -> bool
24
25
{
@@ -44,7 +45,7 @@ constexpr auto equal_parts_impl(T1 lhs_sig, std::int32_t lhs_exp, bool lhs_sign,
44
45
new_lhs_sig == new_rhs_sig;
45
46
}
46
47
47
- template <typename Decimal, typename Integer>
48
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, BOOST_DECIMAL_INTEGRAL Integer>
48
49
constexpr auto mixed_equality_impl (Decimal lhs, Integer rhs) noexcept
49
50
-> std::enable_if_t<(detail::is_decimal_floating_point_v<Decimal> && detail::is_integral_v<Integer>), bool>
50
51
{
@@ -68,7 +69,7 @@ constexpr auto mixed_equality_impl(Decimal lhs, Integer rhs) noexcept
68
69
rhs_significand, INT32_C (0 ), rhs_isneg);
69
70
}
70
71
71
- template <typename Decimal1, typename Decimal2>
72
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
72
73
constexpr auto mixed_decimal_equality_impl (Decimal1 lhs, Decimal2 rhs) noexcept
73
74
-> std::enable_if_t<(detail::is_decimal_floating_point_v<Decimal1> &&
74
75
detail::is_decimal_floating_point_v<Decimal2>), bool>
@@ -87,23 +88,23 @@ constexpr auto mixed_decimal_equality_impl(Decimal1 lhs, Decimal2 rhs) noexcept
87
88
return new_lhs == new_rhs;
88
89
}
89
90
90
- template <typename Decimal1, typename Decimal2>
91
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
91
92
constexpr auto operator ==(Decimal1 lhs, Decimal2 rhs) noexcept
92
93
-> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
93
94
detail::is_decimal_floating_point_v<Decimal2>), bool >
94
95
{
95
96
return mixed_decimal_equality_impl (lhs, rhs);
96
97
}
97
98
98
- template <typename Decimal1, typename Decimal2>
99
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
99
100
constexpr auto operator !=(Decimal1 lhs, Decimal2 rhs) noexcept
100
101
-> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
101
102
detail::is_decimal_floating_point_v<Decimal2>), bool >
102
103
{
103
104
return !(mixed_decimal_equality_impl (lhs, rhs));
104
105
}
105
106
106
- template <typename DecimalType = decimal32, typename T1, typename T2>
107
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE DecimalType = decimal32, typename T1, typename T2>
107
108
constexpr auto less_parts_impl (T1 lhs_sig, std::int32_t lhs_exp, bool lhs_sign,
108
109
T2 rhs_sig, std::int32_t rhs_exp, bool rhs_sign) noexcept -> bool
109
110
{
@@ -163,7 +164,7 @@ constexpr auto less_parts_impl(T1 lhs_sig, std::int32_t lhs_exp, bool lhs_sign,
163
164
}
164
165
}
165
166
166
- template <typename Decimal, typename Integer>
167
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, BOOST_DECIMAL_INTEGRAL Integer>
167
168
constexpr auto less_impl (Decimal lhs, Integer rhs) noexcept
168
169
-> std::enable_if_t<(detail::is_decimal_floating_point_v<Decimal> && detail::is_integral_v<Integer>), bool>
169
170
{
@@ -209,7 +210,7 @@ constexpr auto less_impl(Decimal lhs, Integer rhs) noexcept
209
210
rhs_significand, INT32_C (0 ), rhs_sign);
210
211
}
211
212
212
- template <typename Decimal1, typename Decimal2>
213
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
213
214
constexpr auto mixed_decimal_less_impl (Decimal1 lhs, Decimal2 rhs) noexcept
214
215
-> std::enable_if_t<(detail::is_decimal_floating_point_v<Decimal1> &&
215
216
detail::is_decimal_floating_point_v<Decimal2>), bool>
@@ -240,15 +241,15 @@ constexpr auto mixed_decimal_less_impl(Decimal1 lhs, Decimal2 rhs) noexcept
240
241
rhs.full_significand (), rhs.biased_exponent (), rhs.isneg ());
241
242
}
242
243
243
- template <typename Decimal1, typename Decimal2>
244
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
244
245
constexpr auto operator <(Decimal1 lhs, Decimal2 rhs) noexcept
245
246
-> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
246
247
detail::is_decimal_floating_point_v<Decimal2>), bool >
247
248
{
248
249
return mixed_decimal_less_impl (lhs, rhs);
249
250
}
250
251
251
- template <typename Decimal1, typename Decimal2>
252
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
252
253
constexpr auto operator <=(Decimal1 lhs, Decimal2 rhs) noexcept
253
254
-> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
254
255
detail::is_decimal_floating_point_v<Decimal2>), bool >
@@ -261,15 +262,15 @@ constexpr auto operator<=(Decimal1 lhs, Decimal2 rhs) noexcept
261
262
return !(rhs < lhs);
262
263
}
263
264
264
- template <typename Decimal1, typename Decimal2>
265
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
265
266
constexpr auto operator >(Decimal1 lhs, Decimal2 rhs) noexcept
266
267
-> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
267
268
detail::is_decimal_floating_point_v<Decimal2>), bool >
268
269
{
269
270
return rhs < lhs;
270
271
}
271
272
272
- template <typename Decimal1, typename Decimal2>
273
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
273
274
constexpr auto operator >=(Decimal1 lhs, Decimal2 rhs) noexcept
274
275
-> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
275
276
detail::is_decimal_floating_point_v<Decimal2>), bool >
@@ -284,7 +285,7 @@ constexpr auto operator>=(Decimal1 lhs, Decimal2 rhs) noexcept
284
285
285
286
#ifdef BOOST_DECIMAL_HAS_SPACESHIP_OPERATOR
286
287
287
- template <typename Decimal1, typename Decimal2>
288
+ template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal1, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal2>
288
289
constexpr auto operator <=>(Decimal1 lhs, Decimal2 rhs) noexcept
289
290
-> std::enable_if_t <(detail::is_decimal_floating_point_v<Decimal1> &&
290
291
detail::is_decimal_floating_point_v<Decimal2>), std::partial_ordering>
0 commit comments