cuda::experimental::heterogeneous_iterator

Defined in include/cuda/experimental/__container/heterogeneous_iterator.cuh

template<class _CvTp, class ..._Properties>
class heterogeneous_iterator

Type safe iterator over heterogeneous memory

heterogeneous_iterator provides a type safe access over heterogeneous memory. Depending on whether the memory is tagged as host-accessible and / or device-accessible the iterator restricts memory access. All operations that do not require memory access are always available on host and device.

Template Parameters

Public Types

using iterator_concept = cuda::std::contiguous_iterator_tag
using iterator_category = cuda::std::random_access_iterator_tag
using value_type = cuda::std::remove_const_t<_CvTp>
using difference_type = cuda::std::ptrdiff_t
using pointer = _CvTp*
using reference = _CvTp&

Public Functions

heterogeneous_iterator() = default
inline constexpr heterogeneous_iterator(pointer __ptr) noexcept

Construct a heterogeneous_iterator from a pointer to the underlying memory.

template<class _OtherTp, ::cuda::std::enable_if_t<(cuda::std::is_same_v<_OtherTp, value_type>)&&(cuda::std::is_const_v<_CvTp>), int> = 0>
inline constexpr heterogeneous_iterator(heterogeneous_iterator<_OtherTp, _Properties...> __other) noexcept

Constructs an immutable heterogeneous_iterator from a mutable one.

Parameters

__other – The mutable heterogeneous_iterator

inline constexpr heterogeneous_iterator &operator++() noexcept

Increment of a heterogeneous_iterator.

Returns

The heterogeneous_iterator pointing to the next element

inline constexpr heterogeneous_iterator operator++(int) noexcept

Post-increment of a heterogeneous_iterator.

Returns

A copy of the heterogeneous_iterator pointing to the next element

inline constexpr heterogeneous_iterator &operator--() noexcept

Decrement of a heterogeneous_iterator.

Returns

The heterogeneous_iterator pointing to the previous element

inline constexpr heterogeneous_iterator operator--(int) noexcept

Post-decrement of a heterogeneous_iterator.

Returns

A copy of the heterogeneous_iterator pointing to the previous element

inline constexpr heterogeneous_iterator &operator+=(const difference_type __count) noexcept

Advance a heterogeneous_iterator.

Parameters

__count – The number of elements to advance.

Returns

The heterogeneous_iterator advanced by __count

inline constexpr heterogeneous_iterator operator+(const difference_type __count) const noexcept

Advance a heterogeneous_iterator.

Parameters

__count – The number of elements to advance.

Returns

A copy of this heterogeneous_iterator advanced by __count

inline constexpr heterogeneous_iterator operator+(const difference_type __count, heterogeneous_iterator __other) noexcept

Advance a heterogeneous_iterator.

Parameters
Returns

__other advanced by __count

inline constexpr heterogeneous_iterator &operator-=(const difference_type __count) noexcept

Advance a heterogeneous_iterator by the negative value of __count.

Parameters

__count – The number of elements to advance.

Returns

The heterogeneous_iterator advanced by the negative value of __count

inline constexpr heterogeneous_iterator operator-(const difference_type __count) const noexcept

Advance a heterogeneous_iterator by the negative value of __count.

Parameters

__count – The number of elements to advance.

Returns

A copy of this heterogeneous_iterator advanced by the negative value of __count

inline constexpr difference_type operator-(const heterogeneous_iterator &__other) const noexcept

Distance between two heterogeneous_iterator.

Parameters

__other – The other heterogeneous_iterator.

Returns

The distance between the two elements the heterogeneous_iterator point to

inline constexpr bool operator==(const heterogeneous_iterator &__lhs, const heterogeneous_iterator &__rhs) noexcept

Equality comparison between two heterogeneous_iterator.

Parameters
Returns

true, if both heterogeneous_iterator point to the same element

inline constexpr bool operator<(const heterogeneous_iterator &__lhs, const heterogeneous_iterator &__rhs) noexcept

Less than relation between two heterogeneous_iterator.

Parameters
Returns

true, if the address of the element pointed to by __lhs is less then the address of the one pointed to by __rhs

inline constexpr bool operator<=(const heterogeneous_iterator &__lhs, const heterogeneous_iterator &__rhs) noexcept

Less equal relation between two heterogeneous_iterator.

Parameters
Returns

true, if the address of the element pointed to by __lhs is less then or equal to the address of the one pointed to by __rhs

inline constexpr bool operator>(const heterogeneous_iterator &__lhs, const heterogeneous_iterator &__rhs) noexcept

Greater then relation between two heterogeneous_iterator.

Parameters
Returns

true, if the address of the element pointed to by __lhs is greater then the address of the one pointed to by __rhs

inline constexpr bool operator>=(const heterogeneous_iterator &__lhs, const heterogeneous_iterator &__rhs) noexcept

Greater equal relation between two heterogeneous_iterator.

Parameters
Returns

true, if the address of the element pointed to by __lhs is greater then or equal to the address of the one pointed to by __rhs