tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
common_comparison_category.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
3
#ifndef TETL_COMPARE_COMMON_COMPARISON_CATEGORY_HPP
4
#define TETL_COMPARE_COMMON_COMPARISON_CATEGORY_HPP
5
6
#include <
etl/_compare/partial_ordering.hpp
>
7
#include <
etl/_compare/strong_ordering.hpp
>
8
#include <
etl/_compare/weak_ordering.hpp
>
9
#include <
etl/_type_traits/is_same.hpp
>
10
11
namespace
etl
{
12
13
namespace
detail {
14
15
template
<
unsigned
>
16
struct
common_cmpcat_base {
17
using
type = void;
18
};
19
20
template
<>
21
struct
common_cmpcat_base<0U> {
22
using
type = strong_ordering;
23
};
24
25
template
<>
26
struct
common_cmpcat_base<2U> {
27
using
type = partial_ordering;
28
};
29
30
template
<>
31
struct
common_cmpcat_base<4U> {
32
using
type = weak_ordering;
33
};
34
35
template
<>
36
struct
common_cmpcat_base<6U> {
37
using
type = partial_ordering;
38
};
39
40
}
// namespace detail
41
43
template
<
typename
... Ts>
44
struct
common_comparison_category
45
:
46
// clang-format off
47
detail::common_cmpcat_base<(0U | ... |
48
(is_same_v<Ts, strong_ordering> ? 0U :
49
is_same_v<Ts, weak_ordering> ? 4U :
50
is_same_v<Ts, partial_ordering> ? 2U : 1U)
51
)>
52
// clang-format on
53
{ };
54
57
template
<
typename
... Ts>
58
using
common_comparison_category_t
=
typename
common_comparison_category
<Ts...>::type;
59
60
}
// namespace etl
61
62
#endif
// TETL_COMPARE_COMMON_COMPARISON_CATEGORY_HPP
etl::common_comparison_category::common_comparison_category_t
typename common_comparison_category< Ts... >::type common_comparison_category_t
Definition
common_comparison_category.hpp:58
is_same.hpp
etl
Definition
adjacent_find.hpp:8
partial_ordering.hpp
strong_ordering.hpp
etl::common_comparison_category
Definition
common_comparison_category.hpp:53
weak_ordering.hpp
include
etl
_compare
common_comparison_category.hpp
Generated on Sat Mar 8 2025 16:19:59 for tetl by
1.14.0