On Thursday 03 March 2011 17:54:46 Nick Sabalausky wrote:
> In D2, if you do this:
>
> void foo(char[] key)
> {
> bool[char[]] aa;
> aa[key] = true;
> }
>
> Does that last line allocate a duplicate of key's data?
More like it's illegal. The key type for associative arrays _must_ be
immutable.
Previously, that wasn't check for by the compiler, which meant that it was
possible to change the values of keys (not good), which could quickly result in
an AA in an invalid state. Not too long ago, however, it was fixed so that
that's
not legal.
- Jonathan M Davis