
184 CHAPTER 7. THRUST AND RTH
Note that though dx.begin() acts like a pointer, it is called an iterator,
with broader powers than those of a pointer.
Most of the vector operations in the code are described in the comments.
But where things get interesting is the struct ismultk, which though an
ordinary C struct, is known as a functor in C++ terminology.
A functor is a C++ mechanism to produce a callable function, largely
similar in goal to using a pointer to a function but with the added notion
of saved state. This is done by turning a C++ struct or class object into
a callable function. Since structs and classes can have member variables,
we can store ...