Rang violation using AA's

Maxim Fomin maxim at maxim-fomin.ru
Fri Feb 8 12:29:59 PST 2013


On Friday, 8 February 2013 at 20:10:32 UTC, Nrgyzer wrote:
> void main() {
>    int[string] b;
>    b["hello"] = 3;
> }
>
> This works for both versions... but I don't know why using a 
> method with ref-return value doesn't work anymore.
>
> Thanks for your suggestion.

This works because an element is assigned if absent (expression 
is treated as lvalue). In case of return an element is not 
assigned (rvalue), so exception is thrown. I do not now why it 
worked in 2.060.


More information about the Digitalmars-d-learn mailing list