Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
type_identity.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_TYPE_IDENTITY_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_TYPE_IDENTITY_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
14/// @brief Polyfill of std::type_identity added in C++20
15/// @tparam T The type to preserve
16///
17/// @details
18/// Typically used to prevent parameters from being deduced in order
19/// to avoid ambiguities in type-deduction.
20///
21/// Can also be used as the identity metafunction in some template
22/// metaprogramming expressions.
23///
24/// For example:
25/// @snippet docs/examples/type_traits_examples.cpp type_identity_usage_example
26// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
27template <typename T>
29 public:
30 /// @brief an alias for @c T
31 using type = T;
32};
33// parasoft-end-suppress AUTOSAR-A2_7_3
34
35/// @brief Polyfill of std::type_identity_t added in C++20.
36/// @tparam T The type to preserve
37/// @see arene::base::type_identity
38// parasoft-begin-suppress AUTOSAR-A2_7_3 "False positive: documented"
39template <typename T>
40using type_identity_t = typename type_identity<T>::type;
41// parasoft-end-suppress AUTOSAR-A2_7_3
42
43} // namespace base
44} // namespace arene
45
46#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_TYPE_IDENTITY_HPP_
Polyfill of std::type_identity added in C++20.
Definition type_identity.hpp:28
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10