@@ -24,6 +24,18 @@ Iterators
24
24
The oneDPL iterators are defined in the ``<oneapi/dpl/iterator> `` header,
25
25
in ``namespace oneapi::dpl ``.
26
26
27
+ Let us define a named requirement, ``AdaptingIteratorSource ``, to describe valid random access iterator-like
28
+ types that can be used as source for oneDPL iterators as described below.
29
+ The type ``Iter `` satisfies the ``AdaptingIteratorSource `` named requirement if it is any of the following:
30
+
31
+ * A random access iterator
32
+ * The unspecified iterator-like type returned by ``oneapi::dpl::begin `` or ``oneapi::dpl::end ``
33
+ * A ``permutation_iterator ``
34
+ * A ``transform_iterator ``
35
+ * A ``counting_iterator ``
36
+ * A ``discard_iterator ``
37
+ * A ``zip_iterator ``
38
+
27
39
.. code :: cpp
28
40
29
41
template <typename Integral>
@@ -153,7 +165,19 @@ defined by the source iterator provided, and whose iteration order over the dere
153
165
is defined by either another iterator or a functor that maps the ``permutation_iterator `` index
154
166
to the index of the source iterator. The arithmetic and comparison operators of
155
167
``permutation_iterator `` behave as if applied to integer counter values maintained by the
156
- iterator instances to determine their position in the index map.
168
+ iterator instances to determine their position in the index map. ``SourceIterator `` must satisfy
169
+ ``AdaptingIteratorSource ``.
170
+
171
+ The type ``IndexMap `` must be one of the following:
172
+
173
+ * A random access iterator
174
+ * The unspecified iterator-like type returned by ``oneapi::dpl::begin `` or ``oneapi::dpl::end ``
175
+ * A ``permutation_iterator ``
176
+ * A ``transform_iterator ``
177
+ * A ``counting_iterator ``
178
+ * A functor with a signature equivalent to ``T operator()(const T&) const `` where ``T `` is a
179
+ ``std::iterator_traits<SourceIterator>::difference_type ``
180
+
157
181
158
182
``permutation_iterator::operator* `` uses the counter value of the instance on which
159
183
it is invoked to index into the index map. The corresponding value in the map is then used
@@ -222,7 +246,8 @@ defined by the unary function and source iterator provided. When dereferenced,
222
246
element of the source iterator; dereference operations cannot be used to modify the elements of
223
247
the source iterator unless the unary function result includes a reference to the element. The
224
248
arithmetic and comparison operators of ``transform_iterator `` behave as if applied to the
225
- source iterator itself.
249
+ source iterator itself. The template type ``Iterator `` must satisfy
250
+ ``AdaptingIteratorSource ``.
226
251
227
252
.. code :: cpp
228
253
@@ -280,7 +305,8 @@ using the source iterator and unary function object provided.
280
305
the value returned from ``zip_iterator `` is a tuple of the values returned by dereferencing the
281
306
source iterators over which the ``zip_iterator `` is defined. The arithmetic operators of
282
307
``zip_iterator `` update the source iterators of a ``zip_iterator `` instance as though the
283
- operation were applied to each of these iterators.
308
+ operation were applied to each of these iterators. The types ``T `` within the template pack
309
+ ``Iterators... `` must satisfy ``AdaptingIteratorSource ``.
284
310
285
311
.. code :: cpp
286
312
0 commit comments