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"
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>
46 InputIterator,
48 noexcept(++declval<InputIterator&>())&& noexcept(*declval<InputIterator&>()
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>
69 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<
109 SourceIterator,
110 DestinationIterator,
112 arene::base::algorithm_detail::iter_reference_t<DestinationIterator>,
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<
128 SourceIterator,
129 DestinationIterator,
131 arene::base::algorithm_detail::iter_reference_t<DestinationIterator>,
132 arene::base::algorithm_detail::iter_reference_t<SourceIterator>>>>> = true;
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<
147 SourceIterator,
148 DestinationIterator,
150 arene::base::algorithm_detail::iter_reference_t<DestinationIterator>,
151 arene::base::algorithm_detail::iter_reference_t<SourceIterator>>>>> = true;
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>
173 ForwardIterator,
177
178} // namespace internal
179} // namespace std
180
181#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_ITERATOR_CONCEPTS_HPP_
Public export header for the constraints subpackage.
constexpr bool is_output_iterator_v
Definition iterator_category_traits.hpp:245
constexpr bool is_forward_iterator_v
Definition iterator_category_traits.hpp:290
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
constexpr bool is_input_iterator_v
Definition iterator_category_traits.hpp:259
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....
STL namespace.
typename add_rvalue_reference< Type >::type add_rvalue_reference_t
Add an rvalue reference onto Type.
Definition add_rvalue_reference.hpp:62
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41
constexpr bool is_nothrow_assignable_v
Type trait to detect if an instance of To is assignable to from arguments of From without throwing.
auto declval() noexcept -> T &&
A dummy function that is declared but not defined, with a user-specified return type,...
constexpr bool is_assignable_v
Type trait to detect if an instance of To is assignable to from arguments of From.
constexpr bool is_nothrow_copy_constructible_v
Type trait to detect if an instance of T is copy constructible without throwing.
constexpr bool is_nothrow_default_constructible_v
Type trait to detect if an instance of T is default constructible without throwing.