Boost logo

Boost :

Subject: Re: [boost] [Range] Confusing result of iterator_range::size()
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-11-07 22:29:39


on Mon Nov 07 2011, Nathan Ridge <zeratul976-AT-hotmail.com> wrote:

>> Den 05-11-2011 21:23, Dave Abrahams skrev:
>
>> >
>> > on Sat Nov 05 2011, Olaf van der Spek<ml-AT-vdspek.org> wrote:
>>
>> >> So boost::iterator_range::size() and boost::size() violate this?
>> >
>> > I don't have the spec in front of me, but that's my understanding from
>> > the foregoing conversation.
>>
>> Well, iterator_range<T> is not a container. Could you elaborate on your
>> view?
>
> I think Dave's trying to say that if the size() of a range in a signed
> type, but the size() of a container is an unsigned type, then the container
> concept fails to be a refinement of the range concept, which it should be.

Precisely. Although in theory Range could decide not to specify whether
size() is signed or unsigned (in which case Container would still be a
refinement), I consider that to be premature generalization and needless
complexity at best.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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