Cannot dup an associative array but why?

Jean-Louis Leroy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 10 11:46:39 PDT 2017


Is there something special about ClassInfo that confuses? Look at 
this example:

struct Foo
{

}

class Bar
{
}

void main()
{
   Foo*[Bar] a;
   auto aa = a.dup; // OK
   Foo*[ClassInfo] b; // Error: static assert  "cannot call 
Foo*[TypeInfo_Class].dup because Foo* is not copyable"
   auto bb = b.dup; // instantiated from here: 
dup!(Foo*[TypeInfo_Class], TypeInfo_Class, Foo*)}
}

'Foo*' is not copyable? Except that it is if the key is something 
else than ClassInfo? ClassInfo and Bar are both reference types 
though...


More information about the Digitalmars-d-learn mailing list