thrust
|
#include <thrust/iterator/iterator_facade.h>
Public Types | |
typedef thrust::detail::remove_const< Value >::type | value_type |
typedef Reference | reference |
typedef void | pointer |
typedef Difference | difference_type |
typedef thrust::detail::iterator_facade_category< System, Traversal, Value, Reference >::type | iterator_category |
Public Member Functions | |
__host__ __device__ reference | operator* () const |
__host__ __device__ reference | operator[] (difference_type n) const |
__host__ __device__ Derived & | operator++ () |
__host__ __device__ Derived | operator++ (int) |
__host__ __device__ Derived & | operator-- () |
__host__ __device__ Derived | operator-- (int) |
__host__ __device__ Derived & | operator+= (difference_type n) |
__host__ __device__ Derived & | operator-= (difference_type n) |
__host__ __device__ Derived | operator- (difference_type n) const |
iterator_facade
is 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_facade
defines 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_facade
is too primitive a tool to use for defining novel iterators. In these cases, iterator_adaptor
or a specific fancy iterator should be used instead.
iterator_facade's
functionality is derived from and generally equivalent to boost::iterator_facade
. The exception is Thrust's addition of the template parameter System
, 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 the operator->
member function.
Interested users may refer to boost::iterator_facade
's documentation for usage examples.
iterator_facade's
arithmetic operator free functions exist with the usual meanings but are omitted here for brevity.