Boost logo

Boost :

Subject: Re: [boost] [Range] Confusing result of iterator_range::size()
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-11-03 03:37:10


On Wed, Nov 2, 2011 at 11:42 PM, Sergey Voropaev
<serge-voropaev_at_[hidden]>wrote:

> Hi,
> I try use boost::iterator_range as replacement for some standard container
> in my
> code. The function iterator_range::size() has non standart declaration:
>
> difference_type size() const;
> but not:
> size_type size() const
>
[...]

> I think declaration of boost::iterator_range must be fixed. Or there was
> some
> reason for this non standard declaration?
>

This came up just recently, e.g.,

http://comments.gmane.org/gmane.comp.lib.boost.devel/224758

I think the end result was an agreement that

typedef typename boost::make_unsigned< difference_type >::type size_type

would be a valid definition of size_type, so the only argument against
making the change that I can see is breaking existing code (probably
unlikely...?) and...inertia.

- Jeff


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