Programmer
Programmer

Reputation: 6753

print value pointed to at by thrust iterator

Please see below code:

thrust::device_vector<int>::iterator whereToBegin = copyListOfNgramCounteachdoc.begin();
end = thrust::unique_by_key(end.first, end.first + numUniqueNgrams,end.second);
thrust::device_vector<int>::iterator end1 = end.first;
thrust::device_vector<int>::iterator iter;
for(iter = whereToBegin; iter!=end1; iter++){
    //PRINT VALUE POINTED AT BY ITERATOR
 }

The question is really simple. How do i print the value that iter points at.

Upvotes: 0

Views: 633

Answers (1)

user703016
user703016

Reputation: 37965

In your host code:

std::cout << *iter << std::endl;

Just like standard containers.

Upvotes: 3

Related Questions