Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
decay.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_DECAY_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_DECAY_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
20
21namespace std {
22
23/// @brief Contains @c type, a conversion equivalent to those performed when passing function arguments by value
24/// @tparam Type The type to decay
25template <typename Type>
26class decay {
27 private:
28 /// @brief Reference-erased for building @c type
29 using reference_erased_type = remove_reference_t<Type>;
30
31 public:
32 /// @brief The converted type
33 /// For arrays: A reference-erased element pointer type
34 /// For functions: A reference-erased pointer type
35 /// Otherwise: A reference and cv-erased type
43};
44
45/// @brief A conversion equivalent to those performed when passing function arguments by value
46/// @tparam Type The type to decay
47template <typename Type>
48using decay_t = typename decay<Type>::type;
49
50} // namespace std
51
52#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_DECAY_HPP_
Contains type, a conversion equivalent to those performed when passing function arguments by value.
Definition decay.hpp:26
conditional_t< is_array_v< reference_erased_type >, add_pointer_t< remove_extent_t< reference_erased_type > >, conditional_t< is_function_v< reference_erased_type >, add_pointer_t< reference_erased_type >, remove_cv_t< reference_erased_type > > > type
The converted type For arrays: A reference-erased element pointer type For functions: A reference-era...
Definition decay.hpp:36
STL namespace.
typename remove_cv< T >::type remove_cv_t
An alias for T, but with top-level const and/or volatile qualifiers removed.
Definition remove_cv.hpp:64
typename decay< Type >::type decay_t
A conversion equivalent to those performed when passing function arguments by value.
Definition decay.hpp:48
constexpr bool is_array_v
A type trait to check if a type is an array. The value is true if Type is an array,...
typename conditional< Condition, TrueType, FalseType >::type conditional_t
Helper template alias for selecting types based on a condition. If the supplied Condition is true the...
Definition conditional.hpp:57
constexpr bool is_function_v
A type trait to check if a type is a function. The value is true if Type is a function,...
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