Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
tuple_element.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_TUPLE_ELEMENT_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_TUPLE_ELEMENT_HPP_
7
8// IWYU pragma: private, include <tuple>
9// IWYU pragma: friend "stdlib_detail/.*"
10
11// parasoft-begin-suppress CERT_CPP-DCL58-a-2 "Part of a standard library implementation"
12// parasoft-begin-suppress AUTOSAR-A17_6_1-a-2 "Part of a standard library implementation"
13
14#include "stdlib/include/stdlib_detail/add_const.hpp"
15#include "stdlib/include/stdlib_detail/add_cv.hpp"
16#include "stdlib/include/stdlib_detail/add_volatile.hpp"
17#include "stdlib/include/stdlib_detail/cstddef.hpp"
18
19namespace std {
20
21/// @brief obtains the type of the specified element
22/// @tparam I index to obtain the element type of
23/// @tparam T @c tuple-like type
24///
25/// Provides compile-time indexed access to the types of the elements of a @c tuple-like type.
26///
27template <size_t I, class T>
28class tuple_element; // undefined
29
30/// @brief obtains the type of the specified element
31/// @tparam I index to obtain the element type of
32/// @tparam T @c tuple-like type
33///
34/// Specialization for @c const qualified @c T.
35///
36template <size_t I, class T>
37class tuple_element<I, T const> : public add_const<typename tuple_element<I, T>::type> {};
38
39// parasoft-begin-suppress AUTOSAR-A2_11_1-a "This type trait is required to add volatile"
40
41/// @brief obtains the type of the specified element
42/// @tparam I index to obtain the element type of
43/// @tparam T @c tuple-like type
44///
45/// Specialization for @c volatile qualified @c T.
46///
47template <size_t I, class T>
48class tuple_element<I, T volatile> : public add_volatile<typename tuple_element<I, T>::type> {};
49
50/// @brief obtains the type of the specified element
51/// @tparam I index to obtain the element type of
52/// @tparam T @c tuple-like type
53///
54/// Specialization for @c const and @c volatile qualified @c T.
55///
56template <size_t I, class T>
57class tuple_element<I, T const volatile> : public add_cv<typename tuple_element<I, T>::type> {};
58
59// parasoft-end-suppress AUTOSAR-A2_11_1-a
60
61// parasoft-begin-suppress AUTOSAR-A2_10_1-e "False positive: 'tuple_element_t' does not hide an identifier in
62// 'tuple_leaf'"
63/// @brief obtains the type of the specified element
64/// @tparam I index to obtain the element type of
65/// @tparam T @c tuple-like type
66///
67template <size_t I, class T>
68using tuple_element_t = typename tuple_element<I, T>::type;
69// parasoft-end-suppress AUTOSAR-A2_10_1-e
70
71} // namespace std
72
73#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_TUPLE_ELEMENT_HPP_
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