Hey,
i thought i had understood postblit, but in my Code the following is happening (simplified):

struct C
{
this(this){/*Do sth*/}
list!C;

void opAssign(const C c)
{
 "Postlbit from C called".writeln;
 // Do sth
}
}

struct list(T)
{
node* head;
node* last;
size_t size;

struct node
{
T val;
node* next;
node* prev;

void deleteNode()
{
static if(!isPointer!T){
        static if(__traits(compiles,val.__xdtor))val.__xdtor;
}
}

void constructNodeFrom(ref const T op)
{
 static if(isPointer!T)
 {
  val = cast(T) op;
 }
 else
 {
  val.opAssign(op);
 }
}

~this(){this.erase}
 /// Methods Add, Remove, erase are implemented here ...
}

The nodes are only allocated over malloc(). So i have to take care of the initioalisation myself. The problem is, that i found out by debugging, that it seems that when i call val.opAssign(op) in constructNodeFrom(), there isnt any postblit constructor called in there, the struct seems just to get copied by a memcpy, can that be? Or is it a bug? Shouldnt the postblit constructor get called there?

Greetings

Reply via email to