Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
unwrap_reference.hpp
Go to the documentation of this file.
1// parasoft-begin-suppress AUTOSAR-A2_8_1-a "False positive: also defines arene::base::unwrap_reference"
2// Copyright 2026, Toyota Motor Corporation
3//
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5
6#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_UNWRAP_REFERENCE_HPP_
7#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_UNWRAP_REFERENCE_HPP_
8
9// IWYU pragma: private, include "arene/base/type_traits.hpp"
10// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
11
12#include "arene/base/stdlib_choice/decay.hpp"
13#include "arene/base/stdlib_choice/reference_wrapper_fwd.hpp"
16
17namespace arene {
18namespace base {
19namespace unwrap_reference_detail {
20
21/// @brief obtain the reference type of a std::reference_wrapper
22/// @tparam ReferenceWrapper specialization of std::reference_wrapper
23///
24/// Intended for use as a template alias argument to @c conditional_apply_t.
25template <class ReferenceWrapper>
26using reference_type_t = typename ReferenceWrapper::type&;
27
28} // namespace unwrap_reference_detail
29
30/// @brief Backport of @c std::unwrap_reference_t from C++20
31/// @tparam T A type from which to remove a @c std::reference_wrapper
32// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
33template <class T>
36 unwrap_reference_detail::reference_type_t,
38 T>;
39// parasoft-end-suppress AUTOSAR-A2_7_3
40
41/// @brief Backport of std::unwrap_reference from C++20
42/// @tparam T A type from which to remove a @c std::reference_wrapper
43// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
44template <class T>
46 /// @brief The result type
48};
49// parasoft-end-suppress AUTOSAR-A2_7_3
50
51/// @brief Backport of @c std::unwrap_ref_decay_t from C++20
52/// @tparam T A type to decay and then unwrap a reference wrapper
53// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
54template <class T>
56// parasoft-end-suppress AUTOSAR-A2_7_3
57
58/// @brief Backport of @c std::unwrap_ref_decay from C++20
59/// @tparam T A type to decay and then unwrap a reference wrapper
60// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
61template <class T>
63 public:
64 /// @brief The decayed type @c T , subsequently unwrapped if applicable
66};
67// parasoft-end-suppress AUTOSAR-A2_7_3
68
69} // namespace base
70} // namespace arene
71
72#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_UNWRAP_REFERENCE_HPP_
Backport of std::unwrap_ref_decay from C++20.
Definition unwrap_reference.hpp:62
unwrap_ref_decay_t< T > type
The decayed type T , subsequently unwrapped if applicable.
Definition unwrap_reference.hpp:65
Definition accumulate.hpp:37
constexpr bool is_instantiation_of_v
Definition is_instantiation_of.hpp:16
T conditional_identity_t
an identity alias intended for use as a no-op branch in conditional_apply_t
Definition conditional.hpp:43
conditional_apply_t< is_instantiation_of_v< T, std::reference_wrapper >, unwrap_reference_detail::reference_type_t, conditional_identity_t, T > unwrap_reference_t
Backport of std::unwrap_reference_t from C++20.
Definition unwrap_reference.hpp:34
unwrap_reference_t< std::decay_t< T > > unwrap_ref_decay_t
Backport of std::unwrap_ref_decay_t from C++20.
Definition unwrap_reference.hpp:55
typename static_if< B >::template then_apply_else_apply< OnTrue, OnFalse, Args... > conditional_apply_t
lazily apply one of two template aliases based on a boolean condition
Definition conditional.hpp:73
Definition accumulate.hpp:36
Backport of std::unwrap_reference from C++20.
Definition unwrap_reference.hpp:45
unwrap_reference_t< T > type
The result type.
Definition unwrap_reference.hpp:47