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 <functional>
#include <limits>
......@@ -119,14 +120,12 @@ constexpr bool operator<(const quantity<Derived, ValueType> lhs,
return *lhs < *rhs;
}
template <typename Derived, typename ValueType, typename RhValueType,
typename = std::enable_if_t<std::is_arithmetic_v<RhValueType>>>
template <typename Derived, typename ValueType, arithmetic RhValueType>
constexpr bool operator<(const quantity<Derived, ValueType> lhs, const RhValueType rhs) {
return *lhs < rhs;
}
template <typename Derived, typename ValueType, typename LhValueType,
typename = std::enable_if_t<std::is_arithmetic_v<LhValueType>>>
template <typename Derived, typename ValueType, arithmetic LhValueType>
constexpr bool operator<(const LhValueType lhs, const quantity<Derived, ValueType> rhs) {
return lhs < *rhs;
}
......
Markdown is supported
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