Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
member_pointer_class_type.hpp
Go to the documentation of this file.
1// Copyright 2024, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_MEMBER_POINTER_CLASS_TYPE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_MEMBER_POINTER_CLASS_TYPE_HPP_
7
8// IWYU pragma: private, include "arene/base/type_traits.hpp"
9// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
10
11namespace arene {
12namespace base {
13
14namespace member_pointer_class_type_detail {
15/// @brief A helper struct for obtaining the class type for which the supplied
16/// parameter is a pointer-to-member of.
17/// @tparam PointerToMember The type of the pointer-to-member for which to obtain the class
18/// of which it is a pointer to member of
19template <typename PointerToMember>
20struct member_pointer_class_type_impl;
21
22/// @brief A helper struct for obtaining the class type for which the supplied
23/// parameter is a pointer-to-member of.
24/// This specialization handles the case of a non-qualified pointer-to-member
25/// function.
26/// @tparam R The return type of the member function
27/// @tparam Class The class type of which this is a pointer to member
28/// @tparam MFArgs The arguments for the member function
29// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
30template <typename R, typename Class, typename... MFArgs>
31struct member_pointer_class_type_impl<R (Class::*)(MFArgs...)> {
32 /// @brief An alias to the class type to which the pointer-to-member relates
33 using type = Class;
34};
35// parasoft-end-suppress AUTOSAR-A2_7_3
36
37/// @brief A helper struct for obtaining the class type for which the supplied
38/// parameter is a pointer-to-member of.
39/// This specialization handles the case of a const-qualified pointer-to-member
40/// function.
41/// @tparam R The return type of the member function
42/// @tparam Class The class type of which this is a pointer to member
43/// @tparam MFArgs The arguments for the member function
44// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
45template <typename R, typename Class, typename... MFArgs>
46struct member_pointer_class_type_impl<R (Class::*)(MFArgs...) const> {
47 /// @brief An alias to the class type to which the pointer-to-member relates
48 using type = Class;
49};
50// parasoft-end-suppress AUTOSAR-A2_7_3
51
52/// @brief A helper struct for obtaining the class type for which the supplied
53/// parameter is a pointer-to-member of.
54/// This specialization handles the case of an lvalue-ref-qualified
55/// pointer-to-member function.
56/// @tparam R The return type of the member function
57/// @tparam Class The class type of which this is a pointer to member
58/// @tparam MFArgs The arguments for the member function
59// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
60template <typename R, typename Class, typename... MFArgs>
61struct member_pointer_class_type_impl<R (Class::*)(MFArgs...)&> {
62 /// @brief An alias to the class type to which the pointer-to-member relates
63 using type = Class;
64};
65// parasoft-end-suppress AUTOSAR-A2_7_3
66
67/// @brief A helper struct for obtaining the class type for which the supplied
68/// parameter is a pointer-to-member of.
69/// This specialization handles the case of a const-lvalue-ref-qualified
70/// pointer-to-member function.
71/// @tparam R The return type of the member function
72/// @tparam Class The class type of which this is a pointer to member
73/// @tparam MFArgs The arguments for the member function
74// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
75template <typename R, typename Class, typename... MFArgs>
76struct member_pointer_class_type_impl<R (Class::*)(MFArgs...) const&> {
77 /// @brief An alias to the class type to which the pointer-to-member relates
78 using type = Class;
79};
80// parasoft-end-suppress AUTOSAR-A2_7_3
81
82/// @brief A helper struct for obtaining the class type for which the supplied
83/// parameter is a pointer-to-member of.
84/// This specialization handles the case of a rvalue-ref-qualified
85/// pointer-to-member function.
86/// @tparam R The return type of the member function
87/// @tparam Class The class type of which this is a pointer to member
88/// @tparam MFArgs The arguments for the member function
89// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
90template <typename R, typename Class, typename... MFArgs>
91struct member_pointer_class_type_impl<R (Class::*)(MFArgs...) &&> {
92 /// @brief An alias to the class type to which the pointer-to-member relates
93 using type = Class;
94};
95// parasoft-end-suppress AUTOSAR-A2_7_3
96
97/// @brief A helper struct for obtaining the class type for which the supplied
98/// parameter is a pointer-to-member of.
99/// This specialization handles the case of a const-rvalue-ref-qualified
100/// pointer-to-member function.
101/// @tparam R The return type of the member function
102/// @tparam Class The class type of which this is a pointer to member
103/// @tparam MFArgs The arguments for the member function
104// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
105template <typename R, typename Class, typename... MFArgs>
106struct member_pointer_class_type_impl<R (Class::*)(MFArgs...) const&&> {
107 /// @brief An alias to the class type to which the pointer-to-member relates
108 using type = Class;
109};
110// parasoft-end-suppress AUTOSAR-A2_7_3
111
112/// @brief A helper struct for obtaining the class type for which the supplied
113/// parameter is a pointer-to-member of.
114/// This specialization handles the case of a pointer-to-data-member
115/// @tparam R The type of the pointed to data member
116/// @tparam Class The class type of which this is a pointer to member
117// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
118template <typename R, typename Class>
119struct member_pointer_class_type_impl<R(Class::*)> {
120 /// @brief An alias to the class type to which the pointer-to-member relates
121 using type = Class;
122};
123// parasoft-end-suppress AUTOSAR-A2_7_3
124
125} // namespace member_pointer_class_type_detail
126
127/// @brief A type alias to the class type for which the supplied parameter is a
128/// pointer-to-member of.
129/// @tparam PointerToMember The type of the pointer-to-member for which to obtain the class
130/// of which it is a pointer to member of
131// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
132template <typename PointerToMember>
133using member_pointer_class_type =
134 typename member_pointer_class_type_detail::member_pointer_class_type_impl<PointerToMember>::type;
135// parasoft-end-suppress AUTOSAR-A2_7_3
136
137} // namespace base
138} // namespace arene
139
140#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_MEMBER_POINTER_CLASS_TYPE_HPP_
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10