Edit now with 100% fewer loop variables declared.
template <typename F>
void repeat(unsigned n, F f) {
while (n--) f();
}
Use it as:
repeat(10, f);
or
repeat(10, [] { f(); });
or
int g(int);
repeat(10, std::bind(g, 42));
See it live at http://ideone.com/4k83TJ