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
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>
38class add_pointer<Type, std::enable_if_t<internal::is_referenceable_v<Type> || std::is_void_v<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>
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
Type type
The resulting type.
Definition add_pointer.hpp:32
Adds a pointer to the given type.
Definition add_pointer.hpp:54
Definition add_pointer.hpp:21
STL namespace.
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41
typename remove_reference< T >::type remove_reference_t
An alias for T, but with top-level reference qualifiers removed.
Definition remove_reference.hpp:47
typename add_pointer< Type >::type add_pointer_t
Adds a pointer to the given type.
Definition add_pointer.hpp:62