RFC: naming for FrontTransversal and Transversal ranges

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat May 2 07:08:30 PDT 2009

Robert Jacques wrote:
> On Sat, 02 May 2009 03:35:51 -0400, Andrei Alexandrescu 
> <SeeWebsiteForEmail at erdani.org> wrote:
>> Robert Jacques wrote:
>>>> No, repeated allocations are trivial to eliminate. I didn't even 
>>>> bother to explain that in the article. The loop must only refill the 
>>>> allocated object from the object that needs to be replaced.
>>>  putting the test in the pseudo code for this would've help my 
>>> understanding.
>>>  if(copy is null)
>>>     copy = s.deepDup;
>>> else
>>>     s.deepDupTo(copy);
>> copy = cast(T*) GC.malloc(T.sizeof);
>> do {
>>      overwrite(s, copy);
>>      copy.modify;
>> } while (!cas(copy, s));
> I'm confused. The article talks about copying the entire data structure, 
> not just a node/etc. And trees, etc tend to have variable sizes, etc.

You can reuse memory even if it comprehends more complex patterns than 
one single allocation.


More information about the Digitalmars-d mailing list