Purpose and usage of counting_iterators in CUDA Thrust library
问题 I have trouble understanding counting_iterator in thrust library for CUDA. What is its purpose and how is it used? Is it available in other programming languages such as C++ also? 回答1: A counting iterator is just an iterator which returns the next value from a sequence which is advanced each time the iterator is incremented. The simplest possible example is something like this: #include <iostream> #include <thrust/iterator/counting_iterator.h> int main(void) { int n = 10; thrust::counting