Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
iterator_concepts.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_ITERATOR_CONCEPTS_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ITERATOR_CONCEPTS_HPP_
7
8#include "arene/base/algorithm/detail/traits.hpp"
9#include "arene/base/constraints.hpp"
10#include "arene/base/type_traits/iterator_category_traits.hpp"
11#include "stdlib/include/stdlib_detail/add_rvalue_reference.hpp"
12#include "stdlib/include/stdlib_detail/declval.hpp"
13#include "stdlib/include/stdlib_detail/enable_if.hpp"
14#include "stdlib/include/stdlib_detail/is_assignable.hpp"
15#include "stdlib/include/stdlib_detail/is_convertible.hpp"
16#include "stdlib/include/stdlib_detail/is_copy_constructible.hpp"
17#include "stdlib/include/stdlib_detail/is_default_constructible.hpp"
18#include "stdlib/include/stdlib_detail/is_same.hpp"
19
20// parasoft-begin-suppress CERT_CPP-DCL58-a-2 "Part of a standard library implementation"
21// parasoft-begin-suppress AUTOSAR-A17_6_1-a-2 "Part of a standard library implementation"
22
23// Implementations of iterator concepts used to constrain standard algorithms.
24// TODO: This could be replaced by the arene::base defined iterator concepts.
25
26namespace std {
27namespace internal {
28
29/// @brief Internal type trait to check if a type supports the necessary input iterator operations. @c true if it does,
30/// @c false otherwise
31/// @tparam InputIterator The type to check
32template <typename InputIterator>
34
35/// @brief Internal type trait to check if a type supports the necessary input iterator operations without throwing. @c
36/// true if it does, @c false otherwise
37/// @tparam InputIterator The type to check
38template <typename InputIterator, typename = arene::base::constraints<>>
39extern constexpr bool has_nothrow_basic_input_iterator_operations_v{false};
40
41/// @brief Internal type trait to check if a type supports the necessary input iterator operations without throwing. @c
42/// true if it does, @c false otherwise
43/// @tparam InputIterator The type to check
44template <typename InputIterator>
48 noexcept(++declval<InputIterator&>())&& noexcept(*declval<InputIterator&>()
49 )&& noexcept(declval<InputIterator&>() != declval<InputIterator const&>()) &&
51
52/// @brief Internal type trait to check if a type supports the necessary output iterator operations. @c true if it
53/// does, @c false otherwise
54/// @tparam OutputIterator The type to check
55template <typename OutputIterator>
57
58/// @brief Internal type trait to check if a type supports the necessary output iterator operations without throwing. @c
59/// true if it does, @c false otherwise
60/// @tparam OutputIterator The type to check
61template <typename OutputIterator, typename = arene::base::constraints<>>
62extern constexpr bool has_nothrow_basic_output_iterator_operations_v{false};
63
64/// @brief Internal type trait to check if a type supports the necessary output iterator operations without throwing. @c
65/// true if it does, @c false otherwise
66/// @tparam OutputIterator The type to check
67template <typename OutputIterator>
71 noexcept(++declval<OutputIterator&>())&& noexcept(*declval<OutputIterator&>()) &&
73
74/// @brief Internal type trait to check if a type supports the necessary bidirectional iterator operations without
75/// throwing. @c true if it does, @c false otherwise
76/// @tparam BidirIt The type to check
77template <typename BidirIt, typename = arene::base::constraints<>>
79
80/// @brief Internal type trait to check if a type supports the necessary bidirectional iterator operations without
81/// throwing. @c true if it does, @c false otherwise
82/// @tparam BidirIt The type to check
83template <typename BidirIt>
85 BidirIt,
87 noexcept(--declval<BidirIt&>());
88
89/// @brief Internal type trait to check if the values from a source iterator can be move-assigned to the destination
90/// iterator. @c true if possible, @c false otherwise
91/// @tparam SourceIterator The type of the source iterator
92/// @tparam DestinationIterator The type of the target iterator
93template <typename SourceIterator, typename DestinationIterator, typename = arene::base::constraints<>>
94extern constexpr bool iterator_move_assignable_v{false};
95
96/// @brief Internal type trait to check if the values from an input iterator can be move-assigned to the destination
97/// iterator. @c true if possible, @c false otherwise
98/// @tparam SourceIterator The type of the source iterator
99/// @tparam DestinationIterator The type of the target iterator
100template <typename SourceIterator, typename DestinationIterator, typename = arene::base::constraints<>>
101extern constexpr bool is_indirectly_move_assignable_v{false};
102
103/// @brief Internal type trait to check if the values from an input iterator can be move-assigned to the destination
104/// iterator. @c true if possible, @c false otherwise
105/// @tparam SourceIterator The type of the source iterator
106/// @tparam DestinationIterator The type of the target iterator
107template <typename SourceIterator, typename DestinationIterator>
108extern constexpr bool is_indirectly_move_assignable_v<
114
115/// @brief Internal type trait to check if the values from an input iterator can be copy-assigned to the destination
116/// iterator. @c true if possible, @c false otherwise
117/// @tparam SourceIterator The type of the source iterator
118/// @tparam DestinationIterator The type of the target iterator
119template <typename SourceIterator, typename DestinationIterator, typename = arene::base::constraints<>>
120extern constexpr bool is_indirectly_copy_assignable_v{false};
121
122/// @brief Internal type trait to check if the values from an input iterator can be copy-assigned to the destination
123/// iterator. @c true if possible, @c false otherwise
124/// @tparam SourceIterator The type of the source iterator
125/// @tparam DestinationIterator The type of the target iterator
126template <typename SourceIterator, typename DestinationIterator>
127extern constexpr bool is_indirectly_copy_assignable_v<
133
134/// @brief Internal type trait to check if the values from an input iterator can be copy-assigned to the destination
135/// iterator without throwing. @c true if possible, @c false otherwise
136/// @tparam SourceIterator The type of the source iterator
137/// @tparam DestinationIterator The type of the target iterator
138template <typename SourceIterator, typename DestinationIterator, typename = arene::base::constraints<>>
139extern constexpr bool is_indirectly_nothrow_copy_assignable_v{false};
140
141/// @brief Internal type trait to check if the values from an input iterator can be copy-assigned to the destination
142/// iterator without throwing. @c true if possible, @c false otherwise
143/// @tparam SourceIterator The type of the source iterator
144/// @tparam DestinationIterator The type of the target iterator
145template <typename SourceIterator, typename DestinationIterator>
146extern constexpr bool is_indirectly_nothrow_copy_assignable_v<
152
153/// @brief Internal type trait to check if a type supports the necessary forward iterator operations. @c true if it
154/// does,
155/// @c false otherwise
156/// @tparam ForwardIterator The type to check
157template <typename ForwardIterator>
159
160/// @brief Internal type trait to check if a type supports the necessary forward iterator operations. @c true if it
161/// does,
162/// @c false otherwise
163/// @tparam ForwardIterator The type to check
164template <typename ForwardIterator, typename = arene::base::constraints<>>
165extern constexpr bool has_nothrow_basic_forward_iterator_operations_v{false};
166
167/// @brief Internal type trait to check if a type supports the necessary forward iterator operations. @c true if it
168/// does,
169/// @c false otherwise
170/// @tparam ForwardIterator The type to check
171template <typename ForwardIterator>
177
178} // namespace internal
179} // namespace std
180
181#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ITERATOR_CONCEPTS_HPP_
Definition internal_named_requirements.hpp:19
constexpr bool iterator_move_assignable_v
Internal type trait to check if the values from a source iterator can be move-assigned to the destina...
constexpr bool has_nothrow_basic_input_iterator_operations_v
Internal type trait to check if a type supports the necessary input iterator operations without throw...
constexpr bool is_indirectly_nothrow_copy_assignable_v
Internal type trait to check if the values from an input iterator can be copy-assigned to the destina...
constexpr bool is_indirectly_move_assignable_v
Internal type trait to check if the values from an input iterator can be move-assigned to the destina...
constexpr bool has_nothrow_basic_output_iterator_operations_v
Internal type trait to check if a type supports the necessary output iterator operations without thro...
constexpr bool has_basic_forward_iterator_operations_v
Internal type trait to check if a type supports the necessary forward iterator operations....
constexpr bool has_basic_input_iterator_operations_v
Internal type trait to check if a type supports the necessary input iterator operations....
constexpr bool is_indirectly_copy_assignable_v
Internal type trait to check if the values from an input iterator can be copy-assigned to the destina...
constexpr bool has_nothrow_basic_bidirectional_iterator_operations_v
Internal type trait to check if a type supports the necessary bidirectional iterator operations witho...
constexpr bool has_nothrow_basic_forward_iterator_operations_v
Internal type trait to check if a type supports the necessary forward iterator operations....
constexpr bool has_basic_output_iterator_operations_v
Internal type trait to check if a type supports the necessary output iterator operations....
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