Boost logo

Boost :

Subject: Re: [boost] [Range] Confusing result of iterator_range::size()
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2011-11-04 06:02:30


Den 03-11-2011 16:15, Olaf van der Spek skrev:

>> A couple of years maybe. I think it happened at the same time we demanded
>> that size(Rng) only worked for RandomAccessRanges and that this function
>> also returns a signed type.
>
> IMO the same arguments apply to that function.

Right. They should behave similarly, no matter what is decided that is
the best.

>> Using the old docs, one can probably track down the approximate time.
>>
>> The bottom line is that it was a deliberate decision. The example put
>> forward
>>
>> std::min(bbb.size(), (size_t)arr.size());
>>
>> is not portable either.
>
> My concern was about a.size()< b.size() where one size() returns a
> signed type and the other an unsigned type.

Yes, that happens a lot in C++. Not much we can do about it.

-Thorsten


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