c++ - How to store the vector.begin() iterator of template type in thrust? -


when attempt assign variable iterator, error: expected ";", vec thrust::device_vector<my_type>, j int, , my_type template type:

for (thrust::device_vector<my_type>::iterator = vec.begin(); < vec.end(); += j) foo(i); 

is correct way loop on vector? declaring i correct type?

standard containers use iterators traversing through collection of other objects (i.e. elements), since iterator abstract concept implemented in standard containers, can implement iterators in following way:

typename thrust::device_vector<my_type>::iterator = vec.begin(); (it; != vec.end(); = it+j)     foo(*it); 

here's reference stl containers: http://www.cplusplus.com/reference/stl/


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -