www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - AssociativeArray!(K,V) .init has no [] operator

reply Philippe Sigaud <philippe.sigaud gmail.com> writes:
There has been lots of AssociativeArray-related bugs recently. I'm not sure
this one has been reported, I tried to find it in bugzilla, with no success.

auto aa = (int[int]).init;
aa[3] = 2; // Error, no [] operator overload for type AssociativeArray!(int,int)

whereas this works, obviously:

int[int] aa;
aa[3] = 2;


I use .init a lot in template constraints, as std.algo or .range does. Do other
people here do that also?

  Philippe
Mar 14 2010
parent reply bearophile <bearophileHUGS lycos.com> writes:
Philippe Sigaud:

 There has been lots of AssociativeArray-related bugs recently. I'm not sure
this one has been reported, I tried to find it in bugzilla, with no success.
It's a bug, caused by the change from built-in to partially built-in. I think you can add it to Bugzilla. Bye, bearophile
Mar 14 2010
parent Philippe Sigaud <philippe.sigaud gmail.com> writes:
On Sun, Mar 14, 2010 at 15:57, bearophile <bearophileHUGS lycos.com> wrote:

 It's a bug, caused by the change from built-in to partially built-in. I
 think you can add it to Bugzilla.
Done: http://d.puremagic.com/issues/show_bug.cgi?id=3962
Mar 14 2010