Get rid of isInfinite()?
Christophe Travert
travert at phare.normalesup.org
Tue Jun 26 01:01:13 PDT 2012
Christophe Travert, dans le message (digitalmars.D:170706), a écrit :
> "Mehrdad" , dans le message (digitalmars.D:170697), a écrit :
>> On Monday, 25 June 2012 at 23:03:59 UTC, Jonathan M Davis wrote:
>>> You could store those elements internally as you iterate over
>>> them
>>
>> That's *precisely* the point of my wrapper... sorry if that
>> wasn't clear.
>>
>> Why shouldn't that be sufficient for making it random-access?
>>
>>
>>> If you can somehow figure out how to do that via buffering,
>>> then you could make it a forward range as well as whatever
>>> other range types you could define the functions for, but you'd
>>> have to figure out a way to define save.
>>
>>
>>
>> OK, now we're at the same place. :P
>>
>> What I'm saying is, I __CAN__ get the buffering to work.
>>
>> What I __cannot__ figure out what to do with is 'length'... I
>> can't think of anything reasonable to return, since it's not
>> infinite (which I might represent as ulong.max, if anything) but
>> it's unbounded.
>>
>>
>> So the _ONLY_ problem I'm running into right now is length() --
>> any ideas how I could fix that?
>
> I you are planning to buffer all input as you read it to enable
> random-access, then you should better read the whole file in your buffer
> from the start and get done with it, since you will end up having read
> the whole file in the buffer at the end...
>
Hum, sorry, that is irrelevant if your input is not a file.
More information about the Digitalmars-d
mailing list