#include <iostream>
template <typename T, typename F>
void closed_range(T begin, T end, F functionToPerform)
{
for (T i = begin; i != end; ++i) {
functionToPerform(i);
}
functionToPerform(end);
}
template <typename T>
void doSomething(T value)
{
std::cout << "doSomething(" << value << ")" << std::endl;
}
int main()
{
closed_range( numeric_limits<int>::max() - 10, numeric_limits<int>::max(), doSomething<int> );
return 0;
}