Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
add_pointer.hpp
Go to the documentation of this file.
1// Copyright 2026, 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_ADD_POINTER_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ADD_POINTER_HPP_
7
8#include "stdlib/include/stdlib_detail/declval.hpp"
9#include "stdlib/include/stdlib_detail/enable_if.hpp"
10#include "stdlib/include/stdlib_detail/is_referenceable.hpp"
11#include "stdlib/include/stdlib_detail/is_void.hpp"
12#include "stdlib/include/stdlib_detail/remove_reference.hpp"
13
14// parasoft-begin-suppress CERT_CPP-DCL58-a-2 "Part of a standard library implementation"
15// parasoft-begin-suppress AUTOSAR-A17_6_1-a-2 "Part of a standard library implementation"
16
17// IWYU pragma: private, include <type_traits>
18// IWYU pragma: friend "stdlib_detail/.*"
19namespace std {
20
22
23// parasoft-begin-suppress AUTOSAR-A2_7_3-a "False positive: all declarations
24// and typedefs *are* preceded by a comment with @brief"
25
26/// @brief Base case for when @c Type is not referenceable or void
27/// @tparam T The type to add the pointer to
28template <class Type, class = void>
30 public:
31 /// @brief The resulting type
32 using type = Type;
33};
34
35/// @brief Add a pointer to the given type
36/// @tparam T The type to add the pointer to
37template <class Type>
39 public:
40 /// @brief The resulting type
42};
43
44// parasoft-end-suppress AUTOSAR-A2_7_3-a
45
46} // namespace add_pointer_detail
47
48/// @brief Adds a pointer to the given type
49///
50/// If @c Type is a referenceable type or (possibly cv-qualified) void, the member typedef type provided is typename
51/// std::remove_reference<T>::type*. Otherwise, the member typedef type provided is T.
52/// @tparam T The type to add the pointer to
53template <typename Type>
55
56/// @brief Adds a pointer to the given type
57///
58/// If @c Type is a referenceable type or (possibly cv-qualified) void, the member typedef type provided is typename
59/// std::remove_reference<T>::type*. Otherwise, the member typedef type provided is T.
60/// @tparam T The type to add the pointer to
61template <typename Type>
62using add_pointer_t = typename add_pointer<Type>::type;
63
64} // namespace std
65
66#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ADD_POINTER_HPP_
Base case for when Type is not referenceable or void.
Definition add_pointer.hpp:29
Adds a pointer to the given type.
Definition add_pointer.hpp:54
Definition add_pointer.hpp:21
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