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.

```
What about simply defining a macro?
`#define FOR(N, foo, ...) for (int _i = 0; _i < N; _i++) foo(__VA_ARGS__);`

For eg. 

```
#include <iostream>

#define FOR(N, foo, ...) for (int _i = 0; _i < N; _i++) foo(__VA_ARGS__);

void bar(int a, int b)
{
    std::cout << "hello " << a+b << std::endl;
}

int main()
{
    FOR(5, bar, 12, 6);
    return 0;
}

```

Output:

```
hello 18
hello 18
hello 18
hello 18
hello 18

```