Concepts workaround added to operator/()

This commit is contained in:
Mateusz Pusz
2019-05-08 20:43:52 -06:00
parent 85ab642fc4
commit 1bbbd02f1c

View File

@@ -258,9 +258,9 @@ namespace units {
// template<Dimension D, Unit U, Scalar Rep1, Scalar Rep2> // template<Dimension D, Unit U, Scalar Rep1, Scalar Rep2>
template<typename D, typename U, typename Rep1, typename Rep2> template<typename D, typename U, typename Rep1, typename Rep2>
requires !Quantity<Rep2> [[nodiscard]] constexpr Quantity operator*(const quantity<D, U, Rep1>& q,
/* [[nodiscard]]*/ constexpr Quantity operator*(const quantity<D, U, Rep1>& q,
const Rep2& v) const Rep2& v)
requires (!Quantity<Rep2>)
{ {
using common_rep = decltype(q.count()* v); using common_rep = decltype(q.count()* v);
using ret = quantity<D, U, common_rep>; using ret = quantity<D, U, common_rep>;
@@ -269,9 +269,9 @@ namespace units {
//template<Scalar Rep1, Dimension D, Unit U, Scalar Rep2> //template<Scalar Rep1, Dimension D, Unit U, Scalar Rep2>
template<typename Rep1, typename D, typename U, typename Rep2> template<typename Rep1, typename D, typename U, typename Rep2>
requires !Quantity<Rep1> [[nodiscard]] constexpr Quantity operator*(const Rep1& v,
/* [[nodiscard]]*/ constexpr Quantity operator*(const Rep1& v,
const quantity<D, U, Rep2>& q) const quantity<D, U, Rep2>& q)
requires (!Quantity<Rep1>)
{ {
return q * v; return q * v;
} }
@@ -292,6 +292,7 @@ namespace units {
template<typename Rep1, typename D, typename U, typename Rep2> template<typename Rep1, typename D, typename U, typename Rep2>
[[nodiscard]] constexpr Quantity operator/(const Rep1& v, [[nodiscard]] constexpr Quantity operator/(const Rep1& v,
const quantity<D, U, Rep2>& q) const quantity<D, U, Rep2>& q)
requires (!Quantity<Rep1>)
{ {
Expects(q != std::decay_t<decltype(q)>(0)); Expects(q != std::decay_t<decltype(q)>(0));
@@ -306,6 +307,7 @@ namespace units {
template<typename D, typename U, typename Rep1, typename Rep2> template<typename D, typename U, typename Rep1, typename Rep2>
[[nodiscard]] constexpr Quantity operator/(const quantity<D, U, Rep1>& q, [[nodiscard]] constexpr Quantity operator/(const quantity<D, U, Rep1>& q,
const Rep2& v) const Rep2& v)
requires (!Quantity<Rep2>)
{ {
Expects(v != Rep2{0}); Expects(v != Rep2{0});