Data Structures, Algorithms, & Applications in C++
Chapter 1, Exercise 5

The code for the function iota is given below and in the file iota.cpp.


template <class T>
void iota(T* a, int n, const T& value)
{// Set a[i] = a[i] + value, 0 <= i < n.
   for (int i = 0; i < n; i++)
      a[i] += value;
}