clear array

Damian damianroyday at gmail.com
Mon Oct 15 17:55:27 PDT 2012


On Tuesday, 16 October 2012 at 00:44:15 UTC, Jonathan M Davis 
wrote:
> On Tuesday, October 16, 2012 02:37:52 Andrej Mitrovic wrote:
>> On 10/16/12, Damian <damianroyday at gmail.com> wrote:
>> > Does D have a built-in way to clear arrays dynamic and 
>> > static?
>> 
>> clear(arr).
>> arr.clear() should work too.
>
> Use destroy, not clear. clear is now an alias for clear and 
> should be going
> away eventually. There were too many problems with the 
> ambiguity of the name
> clear, so it was renamed.
>
> - Jonathan M Davis

destroy and clear work nicely, except when using large arrays dmd 
is taking quite a while to compile

int[1000][1000] arr;
destroy(arr);


More information about the Digitalmars-d-learn mailing list