Iros
Loading...
Searching...
No Matches
cmp_less.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
di/meta/language.h
"
4
5
namespace
di::math
{
6
namespace
detail
{
7
struct
CmpLessFunction
{
8
template
<concepts::Integer T, concepts::Integer U>
9
constexpr
auto
operator()
(T a, U b)
const
->
bool
{
10
using
UT =
meta::MakeUnsigned<T>
;
11
using
UU =
meta::MakeUnsigned<U>
;
12
if
constexpr
(
concepts::Signed<T>
==
concepts::Signed<U>
) {
13
return
a < b;
14
}
else
if
constexpr
(
concepts::Signed<T>
) {
15
return
a < 0 ? true : UT(a) < b;
16
}
else
{
17
return
b < 0 ? false : a < UU(b);
18
}
19
}
20
};
21
}
22
23
constexpr
inline
auto
cmp_less
=
detail::CmpLessFunction
{};
24
}
di::concepts::Signed
Definition
language.h:238
language.h
di::math::detail
Definition
abs.h:11
di::math
Definition
abs.h:10
di::math::cmp_less
constexpr auto cmp_less
Definition
cmp_less.h:23
di::meta::MakeUnsigned
detail::MakeUnsignedHelper< RemoveCV< T > >::Type MakeUnsigned
Definition
language.h:362
di::math::detail::CmpLessFunction
Definition
cmp_less.h:7
di::math::detail::CmpLessFunction::operator()
constexpr auto operator()(T a, U b) const -> bool
Definition
cmp_less.h:9
libs
di
include
di
math
intcmp
cmp_less.h
Generated by
1.13.0