The main difference is that
irange
is a random-access range whilecounting_range
isn't.counting_range
is based on Boost.Iterator'scounting_iterator
which uses all the underlying integers operations directly. Integers in C++ almost fit the iterator concept: the only thing missing is anoperator*
.counting_iterator
provides anoperator
* as an identity operation and forwards everything else to the underlying type.