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
10
11namespace etl {
12
13namespace detail {
14
15template <unsigned>
16struct common_cmpcat_base {
17 using type = void;
18};
19
20template <>
21struct common_cmpcat_base<0U> {
22 using type = strong_ordering;
23};
24
25template <>
26struct common_cmpcat_base<2U> {
27 using type = partial_ordering;
28};
29
30template <>
31struct common_cmpcat_base<4U> {
32 using type = weak_ordering;
33};
34
35template <>
36struct common_cmpcat_base<6U> {
37 using type = partial_ordering;
38};
39
40} // namespace detail
41
43template <typename... Ts>
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
57template <typename... Ts>
59
60} // namespace etl
61
62#endif // TETL_COMPARE_COMMON_COMPARISON_CATEGORY_HPP
typename common_comparison_category< Ts... >::type common_comparison_category_t
Definition common_comparison_category.hpp:58
Definition adjacent_find.hpp:8
Definition common_comparison_category.hpp:53