Builtin array and AA efficiency questions

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 15 15:23:41 PDT 2015


On Thursday, October 15, 2015 11:48 PM, Random D user wrote:

> Should array have clear() as well?
> Basically wrap array.length = 0; array.assumeSafeAppend();
> At least it would then be symmetric (and more intuitive) with 
> built-in containers.

No. "clear" is too harmless a name for it to involve an unsafe operation 
like assumeSafeAppend. With containers there is always one container that 
owns the data. There is no such notion with dynamic arrays.


More information about the Digitalmars-d-learn mailing list