Question: I can clearly do something like this:

```
for(int i = 0; i < 10000; i++)
    testIteration();

```

But is there any std functions which does similar thing in one line? Something like that:

```
std::repeat(10000, testIteration);

```

Answer: 
I personally like to use a small helper function to do this.

```
template <typename F>
void repeat(size_t n, F f) {
  while (n--) f();
}

int main() {

   repeat(1000, [&] {
      testIteration();
   });
}

```

This avoids having to spell out the name of a variable. I prefer using view::iota when I need a name though. 

That being said, I'm told this is confusing to read, and everyone *can* read a for loop, so that's probably the way to go. (Unless the function is put in std:: of course).
Just for a reference, there is `std::generate` and `std::generate_n` which can be used, but only for array initialization by doing something like this:

```
int i = 0;
std::generate_n(myArray, 10000, [&]() -> int { return i++; });

```