buffered input

spir denis.spir at gmail.com
Sat Feb 5 03:48:22 PST 2011


On 02/05/2011 08:22 AM, Ellery Newcomer wrote:
>> 2. R defines a primitive shiftFront(size_t n). The semantics of the
>> primitive is that, if r.front.length >= n, then shiftFront(n) discards
>> the first n elements in r.front. Subsequently r.front will return a
>> slice of the remaining elements.
>
> Does shiftFront literally move element n to index 0 and so on? It seems to me
> that if you do, its going to have horrid performance, and if you don't, then
> you will eventually run into situations where appendToFront will require a wrap
> around, which loses you your contiguity, or a reallocation of the buffer.

Is this really what it means? I naively understood "discards" as meaning
     buf = buf[n..$];
or similar.

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list