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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -