1 // { dg-do compile { target c++17 } }
3 // Bug 110512 - C++20 random access iterators run sequentially with PSTL
8 #include <testsuite_iterators.h>
10 using InputIter
= __gnu_test::input_iterator_wrapper
<int>;
11 using FwdIter
= __gnu_test::forward_iterator_wrapper
<long>;
12 using RAIter
= __gnu_test::random_access_iterator_wrapper
<float>;
14 template<typename
... Iter
>
15 constexpr bool all_random_access
16 = __pstl::__internal::__are_random_access_iterators
<Iter
...>::value
;
18 using __pstl::__internal::__are_random_access_iterators
;
19 static_assert( all_random_access
<RAIter
> );
20 static_assert( all_random_access
<int*, RAIter
, const long*> );
21 static_assert( ! all_random_access
<RAIter
, FwdIter
> );
22 static_assert( ! all_random_access
<FwdIter
, InputIter
, RAIter
> );
25 using IotaIter
= std::ranges::iterator_t
<std::ranges::iota_view
<int, int>>;
26 static_assert( std::random_access_iterator
<IotaIter
> );
27 static_assert( all_random_access
<IotaIter
> );
28 static_assert( all_random_access
<IotaIter
, RAIter
> );
29 static_assert( all_random_access
<RAIter
, IotaIter
> );
30 static_assert( ! all_random_access
<RAIter
, IotaIter
, FwdIter
> );