Both irange and counting_range model a random access range for integer types. As indicated in the documentation for counting_range , its iterator category is determined by the following algorithm:
if (CategoryOrTraversal is not use_default) return CategoryOrTraversal else if (numeric_limits<Incrementable>::is_specialized) return iterator-category(random_access_traversal_tag, Incrementable, const Incrementable&) else return iterator-category(iterator_traversal<Incrementable>::type, Incrementable, const Incrementable&)
Therefore, for simple ranges such as boost::irange(0, 10) and boost::counting_range(0, 10) , there is no difference (except for the types of each range, of course!).
However, irange also supports iteration with a different step size, for example, boost::irange(0, 10, 2) and counting_range also supports types that only grow and do not fully model the integer.
Joe
source share