ericniebler/range-v3 — pull request #47 by gnzlbg (2014-09-04 12:53:02+00:00)
Title: Minor improvements to ranges::range

The interface of ranges::range consists of:

- ranges::range(Iterator, Sentinel, Size) -> sized_iterator_range
- ranges::range(Iterator, Sentinel) -> iterator_range

However, when calling ranges::range(I, S) with RandomAccessIterators, we can
compute the range size in O(1) and return a sized_iterator_range.

Furthermore, some containers like `std::list` provide only BidirectionalIterators, but they have
a O(1) size() member function.

This patch changes ranges::range interface to:

- ranges::range(Iterator, Sentinel, Size) -> sized_iterator_range
- ranges::range(Iterator, Sentinel) -> sized_iterator_range if possible, otherwise iterator_range
- ranges::range(Iterable) -> sized_iterator_range if possible, otherwise iterator_range

The ranges::range(Iterable) dispatches to a sized_iterator_range if the Iterable has RandomAccessIterators or ranges::size(Iterable) can compute its size (which is O(1)). Otherwise
it returns an iterator_range.

Note: the algorithm/equal.cpp test used to perform one comparison in the modified CHECK clause when comparing two random access ranges even tho they had different sizes. Now that it knows (since range returns a sized iterator range) it doesn't need to perform any comparison at all.