I know how to fill an std::vector with non-trivial initial values, e.g. sequence numbers:
void IndexArray( unsigned int length, std::vector&a
I usually go with std::generate plus a simple generator:
std::generate
template struct gen { T x; gen(T seed) : x(seed) { } T operator ()() { return x++; } }; generate(a.begin(), a.end(), gen(0));