[Issue 17526] Add a set method for AA

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jul 6 23:13:43 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17526

--- Comment #2 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to hsteoh from comment #1)
> If I have an array A of type const(int)[], I'd expect that I should not be
> able to assign new values to A[0], otherwise it breaks the const guarantee.

If you have an empty array of const(int)[], you can't assign to its elements,
but you can still append to it. In the same way, with an AA of type
const(int)[string], there's no reason why you shouldn't be able to grow the AA.

Such a function would be good to have for performance reasons as well (as
mentioned in passing by OP).

--


More information about the Digitalmars-d-bugs mailing list