Boost logo

Boost :

Subject: Re: [boost] difference_type size()?
From: andrey.semashev_at_[hidden]
Date: 2011-10-19 15:34:44


On Wednesday, October 19, 2011 21:21:00 Olaf van der Spek wrote:
> On Wed, Oct 19, 2011 at 8:50 PM, Jeffrey Lee Hellrung, Jr.
>
> Isn't this problem caused by iterator_traits missing size_type?

Well, the lack of size_type is rather understandable since iterators are not
ranges and there's nothing to be sized with an iterator. An unsigned
distance_type would be more expected though. But what's more important,
std::distance in that case could be formulated the similar way for all
iterator types (i.e. returns the number of increments required for begin to
reach the end).

> What would the problem be of just using std::size_t?

In 99% of cases I assume this would suffice. But I'd still prefer a
make_unsigned-synthesized type.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk