Iros
Loading...
Searching...
No Matches
cmp_equal.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
CmpEqualFunction
{
8
template
<concepts::Integral T, concepts::Integral 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 ? false : UT(a) == b;
16
}
else
{
17
return
b < 0 ? false : a == UU(b);
18
}
19
}
20
};
21
}
22
23
constexpr
inline
auto
cmp_equal
=
detail::CmpEqualFunction
{};
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_equal
constexpr auto cmp_equal
Definition
cmp_equal.h:23
di::meta::MakeUnsigned
detail::MakeUnsignedHelper< RemoveCV< T > >::Type MakeUnsigned
Definition
language.h:362
di::math::detail::CmpEqualFunction
Definition
cmp_equal.h:7
di::math::detail::CmpEqualFunction::operator()
constexpr auto operator()(T a, U b) const -> bool
Definition
cmp_equal.h:9
libs
di
include
di
math
intcmp
cmp_equal.h
Generated by
1.13.0