Associative Array c'tor
cym13 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 12 06:56:49 PDT 2016
On Tuesday, 12 July 2016 at 13:01:20 UTC, ketmar wrote:
> On Tuesday, 12 July 2016 at 12:34:40 UTC, Steven Schveighoffer
> wrote:
>> There was a suggestion to make .clear (a relatively new
>> feature) actually preallocate if it's currently null, but I
>> didn't want to do allocating in that method (too surprising).
>> I do think it would be nice to have an initializer function
>> that simply allocates the impl.
>
> q&n patch[1]. it adds template arg to `.clear`, so no code
> breakage here (old `clear` is still not allocate, but
> `.clear!true` will).
>
>
> [1] https://issues.dlang.org/show_bug.cgi?id=16269
I'm with Steven here, that's definitely too surprising,
initialization should not be linked to clear in any way.
More information about the Digitalmars-d-learn
mailing list