@@ -171,7 +171,7 @@ class zip_forward_iterator
171
171
// On windows, this requires clause is necessary so that concepts in MSVC STL do not detect the iterator as
172
172
// dereferenceable when a source iterator is a sycl_iterator, which is a supported type.
173
173
reference
174
- operator *() const _ONEDPL_CPP20_REQUIRES (std::indirectly_readable<_Types> &&...)
174
+ operator *() const _ONEDPL_CPP20_REQUIRES (std::indirectly_readable<_Types>&&...)
175
175
{
176
176
return __make_references<reference>()(__my_it_, ::std::make_index_sequence<__num_types>());
177
177
}
@@ -235,8 +235,16 @@ class counting_iterator
235
235
counting_iterator () : __my_counter_() {}
236
236
explicit counting_iterator (_Ip __init) : __my_counter_(__init) {}
237
237
238
- reference operator *() const { return __my_counter_; }
239
- reference operator [](difference_type __i) const { return *(*this + __i); }
238
+ reference
239
+ operator *() const
240
+ {
241
+ return __my_counter_;
242
+ }
243
+ reference
244
+ operator [](difference_type __i) const
245
+ {
246
+ return *(*this + __i);
247
+ }
240
248
241
249
difference_type
242
250
operator -(const counting_iterator& __it) const
@@ -328,17 +336,13 @@ class counting_iterator
328
336
return !(*this < __it);
329
337
}
330
338
339
+ friend std::true_type
340
+ is_passed_directly_in_onedpl_device_policies (const counting_iterator&);
341
+
331
342
private:
332
343
_Ip __my_counter_;
333
344
};
334
345
335
- template <typename T>
336
- constexpr auto
337
- is_passed_directly_in_onedpl_device_policies (const oneapi::dpl::counting_iterator<T>&)
338
- {
339
- return std::true_type{};
340
- }
341
-
342
346
template <typename ... _Types>
343
347
class zip_iterator
344
348
{
@@ -361,13 +365,17 @@ class zip_iterator
361
365
// On windows, this requires clause is necessary so that concepts in MSVC STL do not detect the iterator as
362
366
// dereferenceable when a source iterator is a sycl_iterator, which is a supported type.
363
367
reference
364
- operator *() const _ONEDPL_CPP20_REQUIRES (std::indirectly_readable<_Types> &&...)
368
+ operator *() const _ONEDPL_CPP20_REQUIRES (std::indirectly_readable<_Types>&&...)
365
369
{
366
370
return oneapi::dpl::__internal::__make_references<reference>()(__my_it_,
367
371
::std::make_index_sequence<__num_types>());
368
372
}
369
373
370
- reference operator [](difference_type __i) const { return *(*this + __i); }
374
+ reference
375
+ operator [](difference_type __i) const
376
+ {
377
+ return *(*this + __i);
378
+ }
371
379
372
380
difference_type
373
381
operator -(const zip_iterator& __it) const
@@ -467,6 +475,10 @@ class zip_iterator
467
475
return !(*this < __it);
468
476
}
469
477
478
+ friend auto
479
+ is_passed_directly_in_onedpl_device_policies (const zip_iterator&)
480
+ -> std::conjunction<oneapi::dpl::__internal::is_passed_directly_to_device<_Types> ...>;
481
+
470
482
private:
471
483
__it_types __my_it_;
472
484
};
@@ -485,16 +497,6 @@ make_zip_iterator(std::tuple<_Tp...> __arg)
485
497
return zip_iterator<_Tp...>(__arg);
486
498
}
487
499
488
- template <typename ... _Tp>
489
- constexpr auto
490
- is_passed_directly_in_onedpl_device_policies (const oneapi::dpl::zip_iterator<_Tp...>&)
491
- {
492
- if constexpr ((oneapi::dpl::__internal::is_passed_directly_to_device_v<_Tp> && ...))
493
- return std::true_type{};
494
- else
495
- return std::false_type{};
496
- }
497
-
498
500
template <typename _Iter, typename _UnaryFunc>
499
501
class transform_iterator
500
502
{
@@ -553,7 +555,11 @@ class transform_iterator
553
555
{
554
556
return __my_unary_func_ (*__my_it_);
555
557
}
556
- reference operator [](difference_type __i) const { return *(*this + __i); }
558
+ reference
559
+ operator [](difference_type __i) const
560
+ {
561
+ return *(*this + __i);
562
+ }
557
563
transform_iterator&
558
564
operator ++()
559
565
{
@@ -653,15 +659,11 @@ class transform_iterator
653
659
{
654
660
return __my_unary_func_;
655
661
}
662
+ friend auto
663
+ is_passed_directly_in_onedpl_device_policies (const transform_iterator&)
664
+ -> oneapi::dpl::__internal::is_passed_directly_to_device<_Iter>;
656
665
};
657
666
658
- template <typename _It, typename _Unary>
659
- constexpr auto
660
- is_passed_directly_in_onedpl_device_policies (const oneapi::dpl::transform_iterator<_It, _Unary>&)
661
- {
662
- return __internal::is_passed_directly_to_device<_It>{};
663
- }
664
-
665
667
template <typename _Iter, typename _UnaryFunc>
666
668
transform_iterator<_Iter, _UnaryFunc>
667
669
make_transform_iterator (_Iter __it, _UnaryFunc __unary_func)
@@ -745,12 +747,16 @@ class permutation_iterator
745
747
// dereferenceable when the source or map iterator is a sycl_iterator, which is a supported type for both.
746
748
reference
747
749
operator *() const
748
- _ONEDPL_CPP20_REQUIRES (std::indirectly_readable<SourceIterator> && std::indirectly_readable<IndexMap>)
750
+ _ONEDPL_CPP20_REQUIRES (std::indirectly_readable<SourceIterator>&& std::indirectly_readable<IndexMap>)
749
751
{
750
752
return my_source_it[*my_index];
751
753
}
752
754
753
- reference operator [](difference_type __i) const { return *(*this + __i); }
755
+ reference
756
+ operator [](difference_type __i) const
757
+ {
758
+ return *(*this + __i);
759
+ }
754
760
755
761
permutation_iterator&
756
762
operator ++()
@@ -851,6 +857,10 @@ class permutation_iterator
851
857
return !(*this < it);
852
858
}
853
859
860
+ friend auto is_passed_directly_in_onedpl_device_policies (const permutation_iterator&) -> std::conjunction<oneapi::dpl::__internal::is_passed_directly_to_device<SourceIterator>,
861
+ oneapi::dpl::__internal::is_passed_directly_to_device<
862
+ typename oneapi::dpl::permutation_iterator<SourceIterator, _Permutation>::IndexMap>>;
863
+
854
864
private:
855
865
SourceIterator my_source_it;
856
866
IndexMap my_index;
@@ -923,8 +933,16 @@ class discard_iterator
923
933
discard_iterator () : __my_position_() {}
924
934
explicit discard_iterator (difference_type __init) : __my_position_(__init) {}
925
935
926
- reference operator *() const { return internal::ignore; }
927
- reference operator [](difference_type) const { return internal::ignore; }
936
+ reference
937
+ operator *() const
938
+ {
939
+ return internal::ignore;
940
+ }
941
+ reference
942
+ operator [](difference_type) const
943
+ {
944
+ return internal::ignore;
945
+ }
928
946
929
947
// GCC Bug 66297: constexpr non-static member functions of non-literal types
930
948
#if __GNUC__ && _ONEDPL_GCC_VERSION < 70200 && !(__INTEL_COMPILER || __clang__)
@@ -1025,15 +1043,14 @@ class discard_iterator
1025
1043
return !(*this < __it);
1026
1044
}
1027
1045
1028
- private:
1046
+ friend std::true_type
1047
+ is_passed_directly_in_onedpl_device_policies (const discard_iterator&);
1048
+
1049
+ private:
1029
1050
difference_type __my_position_;
1030
1051
};
1031
1052
1032
- constexpr auto
1033
- is_passed_directly_in_onedpl_device_policies (const oneapi::dpl::discard_iterator&)
1034
- {
1035
- return std::true_type{};
1036
- }
1053
+
1037
1054
1038
1055
} // namespace dpl
1039
1056
} // namespace oneapi
0 commit comments