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: 
In the [proposed standard for C++20](http://eel.is/c++draft/range.iota) there is an example for `iota_view`:

```
for (int i : iota_view{1, 10})
  cout << i << ' '; // prints: 1 2 3 4 5 6 7 8 9

```

But for now, [range-v3](https://github.com/ericniebler/range-v3) library can be used:

```
for (int _ : view::iota{0, 10})
    testIteration();            // calls testIteration 10 times.

```
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++; });

```