On Monday, 4 January 2016 at 19:58:03 UTC, Martin Nowak wrote:
On 01/04/2016 09:06 AM, Bastiaan Veelo wrote:


This would be a bug (segfault on my machine):

    foreach (key; aa.byKey)
        aa.remove(key);

Note that, in this example, there is no need to remove every element separately, you can also just do

Sorry my mistake, I never use aa.keys (instead of aa.byKey) b/c it
allocates.
So it's still sort of a bug to recommend people allocating an array ;).


I haven't found a way to clear an AA without allocating though.
(Creating a new one doesn't count).

Reply via email to