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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -