Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
remove_all_extents.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_ALL_EXTENTS_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_REMOVE_ALL_EXTENTS_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 all extents from the given array type
18/// @tparam T The array type to remove all extents from
19///
20/// If @c T is a (multidimensional) array of some type @c X, provides static
21/// member @c type as an alias to @c X. Otherwise if @c T is not an array, @c
22/// 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 all extents from the given array type
34/// @tparam T The array type to remove all extents from
35///
36/// Specialization for array of unknown bound.
37///
38template <typename T>
40 public:
41 /// @brief The resulting type
42 using type = typename remove_all_extents<T>::type;
43};
44
45/// @brief Removes all extents from the given array type
46/// @tparam T The array type to remove all extents from
47/// @tparam N array size
48///
49/// Specialization for array of known bound.
50///
51template <typename T, size_t N>
52class remove_all_extents<T[N]> {
53 public:
54 /// @brief The resulting type
55 using type = typename remove_all_extents<T>::type;
56};
57
58// NOLINTEND(hicpp-avoid-c-arrays)
59
60// parasoft-begin-suppress AUTOSAR-A2_7_3-a-2 "False positive: the typedef *is* preceded by a comment with @brief"
61/// @brief Removes all extents from the given array type
62/// @tparam T The array type to remove the extents from
63///
64/// Alias to @c remove_all_extents<T>::type.
65///
66template <typename T>
67using remove_all_extents_t = typename remove_all_extents<T>::type;
68// parasoft-end-suppress AUTOSAR-A2_7_3-a-2
69
70} // namespace std
71
72#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_REMOVE_ALL_EXTENTS_HPP_
Removes all extents from the given array type.
Definition remove_all_extents.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