Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
remove_pointer.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_STDLIB_INCLUDE_STDLIB_DETAIL_REMOVE_POINTER_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_REMOVE_POINTER_HPP_
7
8// parasoft-begin-suppress CERT_CPP-DCL58-a-2 "Part of a standard library implementation"
9// parasoft-begin-suppress AUTOSAR-A17_6_1-a-2 "Part of a standard library implementation"
10
11// IWYU pragma: private, include <type_traits>
12// IWYU pragma: friend "stdlib_detail/.*"
13
14namespace std {
15
16// parasoft-begin-suppress AUTOSAR-A2_7_3-a "False positive: all declarations
17// and typedefs *are* preceded by a comment with @brief"
18
19// parasoft-begin-suppress AUTOSAR-A14_7_2-a-2 "False positive: All
20// 'remove_pointer' specializations are declared in the same files as the
21// primary template"
22
23/// @brief The @c type member is an alias for the type pointed to by @c T, or the same as @c T if it is not a pointer.
24/// @tparam T The type to remove the pointer from
25template <typename T>
27 public:
28 /// @brief The resulting type
29 using type = T;
30};
31
32/// @brief The @c type member is an alias for the type pointed to by @c T, or the same as @c T if it is not a pointer.
33/// @tparam T The type to remove the pointer from
34template <typename T>
35class remove_pointer<T*> {
36 public:
37 /// @brief The resulting type
38 using type = T;
39};
40
41/// @brief The @c type member is an alias for the type pointed to by @c T, or the same as @c T if it is not a pointer.
42/// @tparam T The type to remove the pointer from
43template <typename T>
44class remove_pointer<T* const> {
45 public:
46 /// @brief The resulting type
47 using type = T;
48};
49
50// parasoft-begin-suppress AUTOSAR-A2_11_1-a-2 "volatile used to remove volatile qualifier"
51/// @brief The @c type member is an alias for the type pointed to by @c T, or the same as @c T if it is not a pointer.
52/// @tparam T The type to remove the pointer from
53template <typename T>
54class remove_pointer<T* volatile> {
55 public:
56 /// @brief The resulting type
57 using type = T;
58};
59
60/// @brief The @c type member is an alias for the type pointed to by @c T, or the same as @c T if it is not a pointer.
61/// @tparam T The type to remove the pointer from
62template <typename T>
63class remove_pointer<T* const volatile> {
64 public:
65 /// @brief The resulting type
66 using type = T;
67};
68// parasoft-end-suppress AUTOSAR-A2_11_1-a-2
69
70/// @brief The @c type member is an alias for the type pointed to by @c T, or the same as @c T if it is not a pointer.
71/// @tparam T The type to remove the pointer from
72template <typename T>
73using remove_pointer_t = typename remove_pointer<T>::type;
74
75// parasoft-end-suppress AUTOSAR-A2_7_3-a
76// parasoft-end-suppress AUTOSAR-A14_7_2-a-2
77
78} // namespace std
79
80#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_REMOVE_POINTER_HPP_
The type member is an alias for the type pointed to by T, or the same as T if it is not a pointer.
Definition remove_pointer.hpp:26
constexpr auto operator()(::arene::base::result< void, E > const &value) const noexcept(noexcept(hash< E >{}(std::declval< E const & >()))) -> std::size_t
Calculate the hash of a result.
Definition result.hpp:1827