dcollections ArrayList pb with mixin template

BLS windevguy at hotmail.de
Fri Jul 2 11:26:08 PDT 2010


On 02/07/2010 00:47, bearophile wrote:
> BLS:
>> I don't understand (in this context) . Can you please elaborate a bit more ?
>
> I have not shown you code because I don't understand your context. But you can put inside static this() {...} code that can't be run statically, like the initialization of a run-time thing.
>
> Bye,
> bearophile
Indeed, the sample snippet was bad 'cause I don't use static.

mixin template TLinkList() {
     alias typeof(this) T;
     //alias LinkList!T TList;

     STATIC T[] pa;
     //static TList list; //= new TList(pa);  // This does not work !

     void opCatAssign(T v) {
         pa ~= v;
     }
...
}

// every struct respective class like
class x {
   // enhanced with
    mixin TlinkList
}
can be used like every other linked list.  (stack, queue, whatever)
well, at least this is my intention.
bjoern


More information about the Digitalmars-d-learn mailing list