21 #ifndef ROCPRIM_ITERATOR_CONSTANT_ITERATOR_HPP_ 22 #define ROCPRIM_ITERATOR_CONSTANT_ITERATOR_HPP_ 27 #include <type_traits> 29 #include "../config.hpp" 34 BEGIN_ROCPRIM_NAMESPACE
49 class Difference = std::ptrdiff_t
55 using value_type =
typename std::remove_const<ValueType>::type;
68 #ifndef DOXYGEN_SHOULD_SKIP_THIS 76 ROCPRIM_HOST_DEVICE
inline 78 : value_(value), index_(index)
82 ROCPRIM_HOST_DEVICE
inline 85 #ifndef DOXYGEN_SHOULD_SKIP_THIS 86 ROCPRIM_HOST_DEVICE
inline 92 ROCPRIM_HOST_DEVICE
inline 98 ROCPRIM_HOST_DEVICE
inline 105 ROCPRIM_HOST_DEVICE
inline 113 ROCPRIM_HOST_DEVICE
inline 120 ROCPRIM_HOST_DEVICE
inline 128 ROCPRIM_HOST_DEVICE
inline 134 ROCPRIM_HOST_DEVICE
inline 141 ROCPRIM_HOST_DEVICE
inline 147 ROCPRIM_HOST_DEVICE
inline 154 ROCPRIM_HOST_DEVICE
inline 159 #endif // DOXYGEN_SHOULD_SKIP_THIS 164 ROCPRIM_HOST_DEVICE
inline 170 #ifndef DOXYGEN_SHOULD_SKIP_THIS 171 ROCPRIM_HOST_DEVICE
inline 174 return value_ == other.value_ && index_ == other.index_;
177 ROCPRIM_HOST_DEVICE
inline 180 return !(*
this == other);
183 ROCPRIM_HOST_DEVICE
inline 186 return distance_to(other) > 0;
189 ROCPRIM_HOST_DEVICE
inline 192 return distance_to(other) >= 0;
195 ROCPRIM_HOST_DEVICE
inline 198 return distance_to(other) < 0;
201 ROCPRIM_HOST_DEVICE
inline 204 return distance_to(other) <= 0;
209 os <<
"[" << iter.value_ <<
"]";
212 #endif // DOXYGEN_SHOULD_SKIP_THIS 225 #ifndef DOXYGEN_SHOULD_SKIP_THIS 230 ROCPRIM_HOST_DEVICE
inline 235 return iter + distance;
237 #endif // DOXYGEN_SHOULD_SKIP_THIS 249 class Difference = std::ptrdiff_t
251 ROCPRIM_HOST_DEVICE
inline 258 END_ROCPRIM_NAMESPACE
263 #endif // ROCPRIM_ITERATOR_CONSTANT_ITERATOR_HPP_ const value_type * pointer
A pointer type of the type iterated over (value_type).
Definition: constant_iterator.hpp:62
A random-access input (read-only) iterator which generates a sequence of homogeneous values...
Definition: constant_iterator.hpp:51
ROCPRIM_HOST_DEVICE constant_iterator(const value_type value, const size_t index=0)
Creates constant_iterator and sets its initial value to value.
Definition: constant_iterator.hpp:77
ROCPRIM_HOST_DEVICE value_type operator[](difference_type) const
Constant_iterator is not writable, so we don't return reference, just something convertible to refere...
Definition: constant_iterator.hpp:165
typename std::remove_const< ValueType >::type value_type
The type of the value that can be obtained by dereferencing the iterator.
Definition: constant_iterator.hpp:55
ROCPRIM_HOST_DEVICE constant_iterator< ValueType, Difference > make_constant_iterator(ValueType value, size_t index=0)
make_constant_iterator creates a constant_iterator with its initial value set to value.
Definition: constant_iterator.hpp:253
value_type reference
A reference type of the type iterated over (value_type).
Definition: constant_iterator.hpp:59
Difference difference_type
A type used for identify distance between iterators.
Definition: constant_iterator.hpp:64
std::random_access_iterator_tag iterator_category
The category of the iterator.
Definition: constant_iterator.hpp:66