[C++-sig] Re: Adding __len__ to range objects
Joel de Guzman
djowel at gmx.co.uk
Sat Sep 6 17:06:26 CEST 2003
Joel de Guzman <djowel at gmx.co.uk> wrote:
> Raoul Gough <RaoulGough at yahoo.co.uk> wrote:
>> I already considered and had to reject an approach like this.
>> Actually, I was thinking of using an iterator pair, but the problem
>> would be the same. A slice on this basis will be in error as soon as
>> an insertion or deletion occurs within the [from,to) range in the
>> original container, since the value lookup is deferred until elements
>
> No, of course not. slice_proxy shouldn't be that naive.
> The slice_proxy can be thought of as:
>
> slice_proxy
> {
> element_proxy from;
> element_proxy to;
> };
>
> The same element_proxy index management should apply to from and to.
Hmmm....
Upon deeper analysis, I think you are right. Let me meditate on this
a bit more. I certainly hope there's a better solution.
--
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net
More information about the Cplusplus-sig
mailing list