thrust::advance
Defined in thrust/advance.h
- 
template<typename InputIterator, typename Distance>
 void thrust::advance(InputIterator &i, Distance n)
- advance(i, n)increments the iterator- iby the distance- n. If- n > 0it is equivalent to executing- ++i- ntimes, and if- n < 0it is equivalent to executing- i- ntimes. If- n == 0, the call has no effect.- The following code snippet demonstrates how to use - advanceto increment an iterator a given number of times.- #include <thrust/advance.h> #include <thrust/device_vector.h> ... thrust::device_vector<int> vec(13); thrust::device_vector<int>::iterator iter = vec.begin(); thrust::advance(iter, 7); // iter - vec.begin() == 7 - Parameters
- i – The iterator to be advanced. 
- n – The distance by which to advance the iterator. 
 
- Template Parameters
- InputIterator – is a model of Input Iterator. 
- Distance – is an integral type that is convertible to - InputIterator'sdistance type.
 
- Pre
- nshall be negative only for bidirectional and random access iterators.