
On Wed, Oct 19, 2011 at 1:46 AM, Olaf van der Spek <ml@vdspek.org> wrote:
On Wed, Oct 19, 2011 at 1:45 AM, Rhys Ulerich <rhys.ulerich@gmail.com> wrote:
iterator_range returns a signed size. Is this correct? IMO it should return size_t.
boost\range\iterator_range_core.hpp: difference_type size() const { return m_End - m_Begin; }
Random thought: It seems like advance_begin and advance_end could be used to create a strictly negative size. Returning difference_type allows this to be detected while a size_type does not.
Sounds like a very weak reason. Especially since: If an instance of iterator_range is constructed by a client with two iterators, the client must ensure that the two iterators delimit a valid closed-open range [begin,end).
If that's the rationale, it'd be better to add is_valid() or so.
What are the requirements on an iterator's difference_type, exactly? Specifically, are you even guaranteed that it is always convertible to *some* unsigned integral type, much less specifically std::size_t? And, if so, how would you deduce such an unsigned integral type? - Jeff