mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 20:34:26 +02:00
Concepts workaround added to operator/()
This commit is contained in:
@@ -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,16 +269,16 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Dimension D1, Unit U1, Scalar Rep1, Dimension D2, Unit U2, Scalar Rep2>
|
template<Dimension D1, Unit U1, Scalar Rep1, Dimension D2, Unit U2, Scalar Rep2>
|
||||||
[[nodiscard]] constexpr Quantity operator*(const quantity<D1, U1, Rep1>& lhs,
|
[[nodiscard]] constexpr Quantity operator*(const quantity<D1, U1, Rep1>& lhs,
|
||||||
const quantity<D2, U2, Rep2>& rhs)
|
const quantity<D2, U2, Rep2>& rhs)
|
||||||
requires treat_as_floating_point<decltype(lhs.count() * rhs.count())> ||
|
requires treat_as_floating_point<decltype(lhs.count() * rhs.count())> ||
|
||||||
(std::ratio_multiply<typename U1::ratio, typename U2::ratio>::den == 1)
|
(std::ratio_multiply<typename U1::ratio, typename U2::ratio>::den == 1)
|
||||||
{
|
{
|
||||||
@@ -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});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user