Commit 818e8bc9 authored by Jan Koniarik's avatar Jan Koniarik
Browse files

quantity now uses arithmetic concept to limit operator<'

parent 81ffb99f
Pipeline #93971 passed with stage
in 36 seconds
#include "emlabcpp/concepts.h"
#include <cmath> #include <cmath>
#include <functional> #include <functional>
#include <limits> #include <limits>
...@@ -119,14 +120,12 @@ constexpr bool operator<(const quantity<Derived, ValueType> lhs, ...@@ -119,14 +120,12 @@ constexpr bool operator<(const quantity<Derived, ValueType> lhs,
return *lhs < *rhs; return *lhs < *rhs;
} }
template <typename Derived, typename ValueType, typename RhValueType, template <typename Derived, typename ValueType, arithmetic RhValueType>
typename = std::enable_if_t<std::is_arithmetic_v<RhValueType>>>
constexpr bool operator<(const quantity<Derived, ValueType> lhs, const RhValueType rhs) { constexpr bool operator<(const quantity<Derived, ValueType> lhs, const RhValueType rhs) {
return *lhs < rhs; return *lhs < rhs;
} }
template <typename Derived, typename ValueType, typename LhValueType, template <typename Derived, typename ValueType, arithmetic LhValueType>
typename = std::enable_if_t<std::is_arithmetic_v<LhValueType>>>
constexpr bool operator<(const LhValueType lhs, const quantity<Derived, ValueType> rhs) { constexpr bool operator<(const LhValueType lhs, const quantity<Derived, ValueType> rhs) {
return lhs < *rhs; return lhs < *rhs;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment