xo-unit: + Dimensionless/Quantity
This commit is contained in:
parent
0f1338921d
commit
5fd8269dcc
1 changed files with 10 additions and 2 deletions
|
|
@ -242,8 +242,7 @@ namespace xo {
|
|||
return Quantity::divide(x, y);
|
||||
}
|
||||
|
||||
/** note: won't have constexpr result until c++26 (when ::sqrt(), ::pow() are constexpr)
|
||||
**/
|
||||
/** note: doesn not require unit scaling, so constexpr with c++23 **/
|
||||
template <typename Quantity, typename Dimensionless>
|
||||
requires quantity2_concept<Quantity> && std::is_arithmetic_v<Dimensionless>
|
||||
constexpr auto
|
||||
|
|
@ -252,6 +251,15 @@ namespace xo {
|
|||
return x.divide_by(y);
|
||||
}
|
||||
|
||||
/** note: doesn not require unit scaling, so constexpr with c++23 **/
|
||||
template <typename Dimensionless, typename Quantity>
|
||||
requires std::is_arithmetic_v<Dimensionless> && quantity2_concept<Quantity>
|
||||
constexpr auto
|
||||
operator/ (Dimensionless x, const Quantity & y)
|
||||
{
|
||||
return y.divide_into(x);
|
||||
}
|
||||
|
||||
/** 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