Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jan Koniarik
emlabcpp
Commits
818e8bc9
Commit
818e8bc9
authored
Jun 03, 2021
by
Jan Koniarik
Browse files
quantity now uses arithmetic concept to limit operator<'
parent
81ffb99f
Pipeline
#93971
passed with stage
in 36 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
include/emlabcpp/quantity.h
View file @
818e8bc9
#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
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment