Cannot dup an associative array but why?

Jean-Louis Leroy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 10 16:24:33 PDT 2017


On Monday, 10 July 2017 at 19:11:37 UTC, Ali Çehreli wrote:
> On 07/10/2017 11:46 AM, Jean-Louis Leroy wrote:
> > 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"
>
> I think you're hitting the same TypeInfo.init issue again. :/ 
> This is the assert that fails inside object.dup:
>
>     static assert(is(typeof({ V v = aa[K.init]; })),
>         "cannot call " ~ T.stringof ~ ".dup because " ~ 
> V.stringof ~ " is not copyable");
>
> Jean-Louis, a little more patience please. :) Hopefully this 
> will be resolved with 2.075, which you should be able to test 
> yourself already. (?) 2.075 is in its fourth beta release.
>
> Ali

Howdy Ali ;-)

Aaaah...those rough edges you were talking about at CppNow?

FYI, having a lot of fun. See 
https://github.com/jll63/meth.d/blob/experiments/source/meth/examples/adventure.d

At the time being, I'm hijacking ClassInfo.deallocator. I hope it 
will live through the next iteration of D.


More information about the Digitalmars-d-learn mailing list