strided_iterator#
-
template<class _Iter, class _Stride = ::cuda::std::iter_difference_t<_Iter>>
class strided_iterator# A
strided_iterator
wraps another iterator and advances it by a specified stride each time it is incremented or decremented.- Template Parameters:
_Iter – A random access iterator
_Stride – Either an integer-like or an integral-constant-like specifying the stride
Public Types
-
using iterator_concept = ::cuda::std::random_access_iterator_tag#
-
using iterator_category = ::cuda::std::random_access_iterator_tag#
Public Functions
-
strided_iterator() = default#
value-initializes both the base iterator and stride
Note
_Iter must be default initializable because it is a random_access_iterator and thereby semiregular _Stride must be integer-like or integral_constant_like which requires default constructability
-
template<class _Stride2 = _Stride, ::cuda::std::enable_if_t<::cuda::std::__integral_constant_like<_Stride2>, int> = 0>
inline explicit constexpr strided_iterator( - _Iter __iter,
Constructs a
strided_iterator
from a base iterator.Note
We cannot construct a
strided_iterator
with an integer-like stride, because that would value construct to 0 and incrementing the iterator would do nothing.- Parameters:
__iter – The base iterator
- inline explicit constexpr strided_iterator( ) noexcept(::cuda::std::is_nothrow_move_constructible_v<_Iter> && ::cuda::std::is_nothrow_move_constructible_v<_Stride>)#
Constructs a
strided_iterator
from a base iterator and a stride.- Parameters:
__iter – The base iterator
__stride – The new stride
-
inline constexpr const _Iter &base() const & noexcept#
Returns a const reference to the stored iterator.
- inline constexpr _Iter base(
Extracts the stored iterator.
- inline constexpr difference_type stride(
Returns the current stride as an integral value.
- inline constexpr decltype(auto) operator*(
Dereferences the stored base iterator.
-
template<class _Iter2 = _Iter, ::cuda::std::enable_if_t<::cuda::std::__dereferenceable<const _Iter2>, int> = 0>
inline constexpr decltype(auto) operator*( Dereferences the stored base iterator.
- inline constexpr decltype(auto) operator[](
- difference_type __n,
Subscripts the stored base iterator with a given offset times the stride.
- Parameters:
__n – The offset
-
template<class _Iter2 = _Iter, ::cuda::std::enable_if_t<::cuda::std::__dereferenceable<const _Iter2>, int> = 0>
inline constexpr decltype(auto) operator[]( - difference_type __n,
Subscripts the stored base iterator with a given offset times the stride.
- Parameters:
__n – The offset
- inline constexpr strided_iterator &operator++(
Increments the stored base iterator by the stride.
- inline constexpr auto operator++(
- int,
Increments the stored base iterator by the stride.
- inline constexpr strided_iterator &operator--(
Decrements the stored base iterator by the stride.
- inline constexpr strided_iterator operator--(
- int,
Decrements the stored base iterator by the stride.
- inline constexpr strided_iterator &operator+=(
- difference_type __n,
Advances a
strided_iterator
by a given number of steps.Note
Increments the base iterator by
__n
times the stride- Parameters:
__n – The number of steps to increment
- inline constexpr strided_iterator &operator-=(
- difference_type __n,
Decrements a
strided_iterator
by a given number of steps.Note
Decrements the base iterator by
__n
times the stride- Parameters:
__n – The number of steps to decrement
Friends
- inline friend constexpr strided_iterator operator+(
- strided_iterator __iter,
- difference_type __n,
Returns a copy of a
strided_iterator
incremented by a given number of steps.- Parameters:
__iter – The
strided_iterator
to advance__n – The number of steps to increment
- inline friend constexpr strided_iterator operator+(
- difference_type __n,
- strided_iterator __iter,
Returns a copy of a
strided_iterator
incremented by a given number of steps.- Parameters:
__n – The number of steps to increment
__iter – The
strided_iterator
to advance
- inline friend constexpr strided_iterator operator-(
- strided_iterator __iter,
- difference_type __n,
Returns a copy of a
strided_iterator
decremented by a given number of steps.- Parameters:
__n – The number of steps to decrement
__iter – The
strided_iterator
to decrement
-
template<class _OtherIter, class _OtherStride>
inline friend constexpr difference_type operator-( - const strided_iterator &__x,
- const strided_iterator<_OtherIter, _OtherStride> &__y,
Returns distance between two
strided_iterator's
in units of the stride.
-
template<class _OtherIter, class _OtherStride>
inline friend constexpr bool operator==( - const strided_iterator &__x,
- const strided_iterator<_OtherIter, _OtherStride> &__y,
Compares two
strided_iterator's
for equality by comparing the stored iterators.
-
template<class _OtherIter, class _OtherStride>
inline friend constexpr bool operator<( - const strided_iterator &__x,
- const strided_iterator<_OtherIter, _OtherStride> &__y,
Compares two
strided_iterator's
for less than by comparing the stored iterators.
-
template<class _OtherIter, class _OtherStride>
inline friend constexpr bool operator>( - const strided_iterator &__x,
- const strided_iterator<_OtherIter, _OtherStride> &__y,
Compares two
strided_iterator's
for greater than by comparing the stored iterators.
-
template<class _OtherIter, class _OtherStride>
inline friend constexpr bool operator<=( - const strided_iterator &__x,
- const strided_iterator<_OtherIter, _OtherStride> &__y,
Compares two
strided_iterator's
for less equal by comparing the stored iterators.
-
template<class _OtherIter, class _OtherStride>
inline friend constexpr bool operator>=( - const strided_iterator &__x,
- const strided_iterator<_OtherIter, _OtherStride> &__y,
Compares two
strided_iterator's
for greater equal by comparing the stored iterators.
-
template<class _Stride, class _Iter>
inline constexpr auto make_strided_iterator( - _Iter __iter,
Creates a
strided_iterator
from a random access iterator.- Parameters:
__iter – The random_access iterator
-
template<class _Iter, class _Stride>
inline constexpr auto make_strided_iterator(
)# Creates a
strided_iterator
from a random access iterator and a stride.- Parameters:
__iter – The random_access iterator
__stride – The new stride