xo-unit: share operator impls
This commit is contained in:
parent
1dd6ac7d80
commit
5735a3525f
2 changed files with 11 additions and 20 deletions
|
|
@ -47,6 +47,17 @@ namespace xo {
|
|||
{
|
||||
return (Quantity::compare(x, y) == 0);
|
||||
}
|
||||
|
||||
/** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr)
|
||||
**/
|
||||
template <typename Quantity, typename Quantity2>
|
||||
requires quantity2_concept<Quantity> && quantity2_concept<Quantity2>
|
||||
constexpr auto
|
||||
operator<=> (const Quantity & x, const Quantity2 & y)
|
||||
{
|
||||
return Quantity::compare(x, y);
|
||||
}
|
||||
|
||||
} /*namespace qty*/
|
||||
|
||||
} /*namespace xo*/
|
||||
|
|
|
|||
|
|
@ -331,16 +331,6 @@ namespace xo {
|
|||
return Quantity(x, nu::dimensionless) - y;
|
||||
}
|
||||
|
||||
/** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr)
|
||||
**/
|
||||
template <typename Quantity, typename Quantity2>
|
||||
requires quantity2_concept<Quantity> && quantity2_concept<Quantity2>
|
||||
constexpr auto
|
||||
operator== (const Quantity & x, const Quantity2 & y)
|
||||
{
|
||||
return (Quantity::compare(x, y) == 0);
|
||||
}
|
||||
|
||||
/** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr)
|
||||
**/
|
||||
template <typename Quantity>
|
||||
|
|
@ -361,16 +351,6 @@ namespace xo {
|
|||
return (Quantity(x, nu::dimensionless) == y);
|
||||
}
|
||||
|
||||
/** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr)
|
||||
**/
|
||||
template <typename Quantity, typename Quantity2>
|
||||
requires quantity2_concept<Quantity> && quantity2_concept<Quantity2>
|
||||
constexpr auto
|
||||
operator<=> (const Quantity & x, const Quantity2 & y)
|
||||
{
|
||||
return Quantity::compare(x, y);
|
||||
}
|
||||
|
||||
/** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr)
|
||||
**/
|
||||
template <typename Quantity, double>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue