Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
remove_extent.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_STDLIB_INCLUDE_STDLIB_DETAIL_REMOVE_EXTENT_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_REMOVE_EXTENT_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
14#include "stdlib/include/stdlib_detail/cstddef.hpp"
15
16namespace std {
17/// @brief Removes the first extent from the given array type
18/// @tparam T The array type to remove the first extent from
19///
20/// If @c T is an array of some type @c X, provides static member @c type as an
21/// alias to @c X. If @c T is multidimensional array, only the first dimension
22/// is removed. Otherwise if @c T is not an array, @c type is an alias to @c T.
23///
24template <typename T>
26 public:
27 /// @brief The resulting type
28 using type = T;
29};
30
31// NOLINTBEGIN(hicpp-avoid-c-arrays)
32
33/// @brief Removes the first extent from the given array type
34/// @tparam T The array type to remove the first extent from
35///
36/// Specialization for array of unknown bound.
37///
38template <typename T>
39class remove_extent<T[]> {
40 public:
41 /// @brief The resulting type
42 using type = T;
43};
44
45/// @brief Removes the first extent from the given array type
46/// @tparam T The array type to remove the first extent from
47/// @tparam N array size
48///
49/// Specialization for array of known bound.
50///
51template <typename T, size_t N>
52class remove_extent<T[N]> {
53 public:
54 /// @brief The resulting type
55 using type = T;
56};
57
58// NOLINTEND(hicpp-avoid-c-arrays)
59
60/// @brief Removes the first extent from the given array type
61/// @tparam T The array type to remove the first extent from
62///
63/// Alias to @c remove_extent<T>::type.
64///
65template <typename T>
66using remove_extent_t = typename remove_extent<T>::type;
67
68} // namespace std
69
70#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_REMOVE_EXTENT_HPP_
Removes the first extent from the given array type.
Definition remove_extent.hpp:25
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