xo-unit: operator+ overloads for (xquantity, double)
This commit is contained in:
parent
bb90a37460
commit
a91c90fad4
1 changed files with 20 additions and 0 deletions
|
|
@ -311,6 +311,26 @@ namespace xo {
|
|||
return Quantity::add(x, y);
|
||||
}
|
||||
|
||||
/** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr)
|
||||
**/
|
||||
template <typename Quantity>
|
||||
requires quantity2_concept<Quantity>
|
||||
constexpr auto
|
||||
operator+ (const Quantity & x, double y)
|
||||
{
|
||||
return x + Quantity(y, nu::dimensionless);
|
||||
}
|
||||
|
||||
/** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr)
|
||||
**/
|
||||
template <typename Quantity>
|
||||
requires quantity2_concept<Quantity>
|
||||
constexpr auto
|
||||
operator+ (double x, const Quantity & y)
|
||||
{
|
||||
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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue