I found myself writing this just a bit ago:
template
class range_class {
public:
class iterator {
friend c
I found that boost::irange was much slower than the canonical integer loop. So I settled on the following much simpler solution using a preprocessor macro:
#define RANGE(a, b) unsigned a=0; a
Then you can loop like this:
for(RANGE(i, n)) {
// code here
}
This range automatically starts from zero. It could be easily extended to start from a given number.