thrust::iterator_facade#
-
template<typename Derived, typename Value, typename System, typename Traversal, typename Reference, typename Difference = ::cuda::std::ptrdiff_t>
class iterator_facade# iterator_facadeis a template which allows the programmer to define a novel iterator with a standards-conforming interface which Thrust can use to reason about algorithm acceleration opportunities.Because most of a standard iterator’s interface is defined in terms of a small set of core primitives,
iterator_facadedefines the non-primitive portion mechanically. In principle a novel iterator could explicitly provide the entire interface in an ad hoc fashion but doing so might be tedious and prone to subtle errors.Often
iterator_facadeis too primitive a tool to use for defining novel iterators. In these cases,iterator_adaptoror a specific fancy iterator should be used instead.iterator_facade'sfunctionality is derived from and generally equivalent toboost::iterator_facade. The exception is Thrust’s addition of the template parameterSystem, which is necessary to allow Thrust to dispatch an algorithm to one of several parallel backend systems. An additional exception is Thrust’s omission of theoperator->member function.Interested users may refer to
boost::iterator_facade’s documentation for usage examples.Note
iterator_facade'sarithmetic operator free functions exist with the usual meanings but are omitted here for brevity.Public Types
-
using value_type = ::cuda::std::remove_const_t<Value>#
The type of element pointed to by
iterator_facade.
-
using reference = Reference#
The return type of
iterator_facade::operator*().
-
using pointer = void#
The return type of
iterator_facade'snon-existentoperator->()member function. Unlikeboost::iterator_facade,iterator_facadedisallows access to thevalue_type'smembers through expressions of the formiter->member.pointeris defined tovoidto indicate that these expressions are not allowed. This limitation may be relaxed in a future version of Thrust.
-
using difference_type = Difference#
The type of expressions of the form
x - ywherexandyare of typeiterator_facade.
-
using iterator_category = detail::iterator_facade_category_t<System, Traversal>#
The type of iterator category of
iterator_facade.
Public Functions
-
inline reference operator*() const#
operator*()dereferences thisiterator_facade.- Returns:
A reference to the element pointed to by this
iterator_facade.
-
inline reference operator[](difference_type n) const#
operator[] performs indexed dereference.- Returns:
A reference to the element
ndistance away from thisiterator_facade.
-
inline Derived &operator++()#
operator++pre-increments thisiterator_facadeto refer to the element in the next position.- Returns:
*this
-
inline Derived operator++(int)#
operator++post-increments thisiterator_facadeand returns a newiterator_facadereferring to the element in the next position.- Returns:
A copy of
*thisbefore increment.
-
inline Derived &operator--()#
operator--pre-decrements thisiterator_facadeto refer to the element in the previous position.- Returns:
*this
-
inline Derived operator--(int)#
operator--post-decrements thisiterator_facadeand returns a newiterator_facadereferring to the element in the previous position.- Returns:
A copy of
*thisbefore decrement.
-
inline Derived &operator+=(difference_type n)#
operator+=increments thisiterator_facadeto refer to an element a given distance after its current position.- Parameters:
n – The quantity to increment.
- Returns:
*this
-
inline Derived &operator-=(difference_type n)#
operator-=decrements thisiterator_facadeto refer to an element a given distance before its current position.- Parameters:
n – The quantity to decrement.
- Returns:
*this
-
inline Derived operator-(difference_type n) const#
operator-subtracts a given quantity from thisiterator_facadeand returns a newiterator_facadereferring to the element at the given position before thisiterator_facade.- Parameters:
n – The quantity to decrement
- Returns:
An
iterator_facadepointingnelements before thisiterator_facade.
-
using value_type = ::cuda::std::remove_const_t<Value>#