Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
is_transparent_comparator_for.hpp
Go to the documentation of this file.
1// parasoft-begin-suppress AUTOSAR-A2_8_1-a-2 "False positive: also defines arene::base::is_transparent_comparator_for"
2
3// Copyright 2026, Toyota Motor Corporation
4//
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
7///
8/// @file is_transparent_comparator_for.hpp
9/// @brief Provides implementation of arene::base::is_transparent_comparator_for
10///
11#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_IS_TRANSPARENT_COMPARATOR_FOR_HPP_
12#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_IS_TRANSPARENT_COMPARATOR_FOR_HPP_
13
14// IWYU pragma: private, include "arene/base/type_traits.hpp"
15// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
16
18#include "arene/base/stdlib_choice/integral_constant.hpp"
20
21namespace arene {
22namespace base {
23
24/// @brief Trait to determine if a given type is a _transparent comparator_.
25///
26/// @tparam C The type to test
27///
28/// Value will be @c true if @c C::is_transparent exists and is a type definition, else @c false
29// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
30template <typename C, typename = void>
32// parasoft-end-suppress AUTOSAR-A2_7_3
33
34/// @brief Trait to determine if a given type is a _transparent comparator_.
35///
36/// This specialization handles the case that @c C is a transparent comparator
37///
38/// @tparam C The type to test
39///
40// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
41template <typename C>
42class is_transparent_comparator<C, void_t<typename C::is_transparent>> : public std::true_type {};
43// parasoft-end-suppress AUTOSAR-A2_7_3
44
45/// @brief Trait to determine if a given type is a _transparent comparator_.
46///
47/// @tparam C The type to test
48/// @return true If @c C::is_transparent exists and is a type definition
49/// @return false If @c C::is_transparent does not exist, or is not a type definition.
50template <typename C>
52
53/// @brief Trait to determine if a given type is a _transparent comparator_ for a given set of operands.
54///
55/// @tparam C The type to test
56/// @tparam T The type of the left hand operand
57/// @tparam U The type of the right hand operand
58/// @return bool Will be equivalent to <c>is_transparent_comparator_v<C> && is_invocable_r_v<bool, C, T, U></c>.
59template <typename C, typename T, typename U = T>
60extern constexpr bool is_transparent_comparator_for_v =
62
63/// @brief Trait to determine if a given type is a _transparent comparator_ for a given set of operands.
64///
65/// @tparam C The type to test
66/// @tparam T The type of the left hand operand
67/// @tparam U The type of the right hand operand
68/// @var value Will be equivalent to <c>is_transparent_comparator_v<C> && is_invocable_r_v<bool, C, T, U></c>.
69// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
70template <typename C, typename T, typename U = T>
72// parasoft-end-suppress AUTOSAR-A2_7_3
73
74} // namespace base
75} // namespace arene
76
77#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_IS_TRANSPARENT_COMPARATOR_FOR_HPP_
Trait to determine if a given type is a transparent comparator.
Definition is_transparent_comparator_for.hpp:31
A helper class to represent a compile-time constant with the specified type and value....
Definition integral_constant.hpp:23
static constexpr value_type value
Definition integral_constant.hpp:34
Definition accumulate.hpp:37
constexpr bool is_invocable_r_v
Determine if a functor type is invocable with the specified return and argument types.
void void_t
An alias for void that accepts any number of type parameters, used for substitution checks.
Definition substitution_succeeds.hpp:17
constexpr bool is_transparent_comparator_v
Trait to determine if a given type is a transparent comparator.
constexpr bool is_transparent_comparator_for_v
Trait to determine if a given type is a transparent comparator for a given set of operands.
std::integral_constant< bool, is_transparent_comparator_for_v< C, T, U > > is_transparent_comparator_for
Definition is_transparent_comparator_for.hpp:71
Definition accumulate.hpp:36
bool_constant< false > false_type
An alias for bool_constant<false>
Definition integral_constant.hpp:79
bool_constant< true > true_type
An alias for bool_constant<true>
Definition integral_constant.hpp:76