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:
--002354332f1af6a4be0481c946ac
Content-Type: text/plain; charset=ISO-8859-1

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 Hmm, almost bug #4000. --002354332f1af6a4be0481c946ac Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On Sun, Mar 14, 2010 at 15:57, bearophile <span = dir=3D"ltr">&lt;<a href=3D"mailto:bearophileHUGS lycos.com">bearophileHUGS = lycos.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style= =3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); p= adding-left: 1ex;"> <br> It&#39;s a bug, caused by the change from built-in to partially built-in. I= think you can add it to Bugzilla.<br></blockquote><div><br>Done:<br><br><a= href=3D"http://d.puremagic.com/issues/show_bug.cgi?id=3D3962">http://d.pur= emagic.com/issues/show_bug.cgi?id=3D3962</a><br> <br>Hmm, almost bug #4000.<br>=A0<br></div></div> --002354332f1af6a4be0481c946ac--
Mar 14 2010