refactor: merged op% of quantity_kind into one

Relates to #221
This commit is contained in:
Mateusz Pusz
2021-05-11 19:40:58 +02:00
parent c95e20c7ea
commit 0174572645

View File

@ -228,22 +228,17 @@ public:
q_ %= rhs; q_ %= rhs;
return *this; return *this;
} }
template<typename Rep2>
constexpr quantity_kind& operator%=(const quantity_kind<downcast_kind<K, dim_one>, units::one, Rep2>& rhs) template<QuantityKind QK>
requires requires(quantity_type q) { q %= rhs.common(); } constexpr quantity_kind& operator%=(const QK& rhs)
requires (QuantityKindEquivalentTo<QK, quantity_kind> || std::same_as<typename QK::kind_type, downcast_kind<K, dim_one>>) &&
requires(quantity_type q) { q %= rhs.common(); }
{ {
gsl_ExpectsAudit(rhs.common().number() != quantity_values<typename QK::rep>::zero());
q_ %= rhs.common(); q_ %= rhs.common();
return *this; return *this;
} }
constexpr quantity_kind& operator%=(const quantity_kind& qk)
requires requires(quantity_type q) { q %= qk.common(); }
{
gsl_ExpectsAudit(qk.common().number() != quantity_values<rep>::zero());
q_ %= qk.common();
return *this;
}
// Hidden Friends // Hidden Friends
// Below friend functions are to be found via argument-dependent lookup only // Below friend functions are to be found via argument-dependent lookup only
template<Representation Value> template<Representation Value>