21 #ifndef ROCPRIM_ITERATOR_COUNTING_ITERATOR_HPP_ 22 #define ROCPRIM_ITERATOR_COUNTING_ITERATOR_HPP_ 27 #include <type_traits> 29 #include "../config.hpp" 30 #include "../type_traits.hpp" 35 BEGIN_ROCPRIM_NAMESPACE
49 class Difference = std::ptrdiff_t
55 using value_type =
typename std::remove_const<Incrementable>::type;
68 static_assert(std::is_integral<value_type>::value,
"Incrementable must be integral type");
70 #ifndef DOXYGEN_SHOULD_SKIP_THIS 74 ROCPRIM_HOST_DEVICE
inline 79 ROCPRIM_HOST_DEVICE
inline 85 ROCPRIM_HOST_DEVICE
inline 90 #ifndef DOXYGEN_SHOULD_SKIP_THIS 91 ROCPRIM_HOST_DEVICE
inline 98 ROCPRIM_HOST_DEVICE
inline 106 ROCPRIM_HOST_DEVICE
inline 113 ROCPRIM_HOST_DEVICE
inline 121 ROCPRIM_HOST_DEVICE
inline 127 ROCPRIM_HOST_DEVICE
inline 133 ROCPRIM_HOST_DEVICE
inline 139 ROCPRIM_HOST_DEVICE
inline 146 ROCPRIM_HOST_DEVICE
inline 152 ROCPRIM_HOST_DEVICE
inline 159 ROCPRIM_HOST_DEVICE
inline 168 ROCPRIM_HOST_DEVICE
inline 171 return value_ +
static_cast<value_type>(distance);
174 ROCPRIM_HOST_DEVICE
inline 177 return this->equal_value(value_, other.value_);
180 ROCPRIM_HOST_DEVICE
inline 183 return !(*
this == other);
186 ROCPRIM_HOST_DEVICE
inline 189 return distance_to(other) > 0;
192 ROCPRIM_HOST_DEVICE
inline 195 return distance_to(other) >= 0;
198 ROCPRIM_HOST_DEVICE
inline 201 return distance_to(other) < 0;
204 ROCPRIM_HOST_DEVICE
inline 207 return distance_to(other) <= 0;
212 os <<
"[" << iter.value_ <<
"]";
215 #endif // DOXYGEN_SHOULD_SKIP_THIS 220 bool equal_value(
const T& x,
const T& y)
const 234 #ifndef DOXYGEN_SHOULD_SKIP_THIS 239 ROCPRIM_HOST_DEVICE
inline 244 return iter + distance;
246 #endif // DOXYGEN_SHOULD_SKIP_THIS 257 class Difference = std::ptrdiff_t
259 ROCPRIM_HOST_DEVICE
inline 266 END_ROCPRIM_NAMESPACE
271 #endif // ROCPRIM_ITERATOR_COUNTING_ITERATOR_HPP_ std::random_access_iterator_tag iterator_category
The category of the iterator.
Definition: counting_iterator.hpp:66
ROCPRIM_HOST_DEVICE counting_iterator< Incrementable, Difference > make_counting_iterator(Incrementable value)
make_counting_iterator creates a counting_iterator with its initial value set to value.
Definition: counting_iterator.hpp:261
value_type reference
A reference type of the type iterated over (value_type).
Definition: counting_iterator.hpp:59
typename std::remove_const< Incrementable >::type value_type
The type of the value that can be obtained by dereferencing the iterator.
Definition: counting_iterator.hpp:55
const value_type * pointer
A pointer type of the type iterated over (value_type).
Definition: counting_iterator.hpp:62
ROCPRIM_HOST_DEVICE counting_iterator(const value_type value)
Creates counting_iterator and sets its initial value to value_.
Definition: counting_iterator.hpp:86
ROCPRIM_HOST_DEVICE ~counting_iterator()=default
Creates counting_iterator with its initial value initialized to its default value (usually 0)...
Difference difference_type
A type used for identify distance between iterators.
Definition: counting_iterator.hpp:64
A random-access input (read-only) iterator over a sequence of consecutive integer values...
Definition: counting_iterator.hpp:51