Thrust
|
#include <thrust/iterator/transform_input_output_iterator.h>
transform_input_output_iterator
is a special kind of iterator which applies transform functions when reading from or writing to dereferenced values. This iterator is useful for algorithms that operate on a type that needs to be serialized/deserialized from values in another iterator, avoiding the need to materialize intermediate results in memory. This also enables the transform functions to be fused with the operations that read and write to the transform_input_output_iterator
.
The following code snippet demonstrates how to create a transform_input_output_iterator
which performs different transformations when reading from and writing to the iterator.