clear()

Kai Meyer kai at unixlords.com
Mon Mar 28 07:57:17 PDT 2011


On 03/25/2011 01:10 PM, Dr.Smith wrote:
> To empty many arrays of various types, rather than:
>
> clear(arr1);
> clear(arr2);
> ...
> clear(arrN);
>
> is there something like:
>
> clear(ALL);

No, but perhaps you can do a:
foreach(a; ALL)
   a.clear()

But that would require you having an iterable sequence that contains all 
of your arrays, which may or may not be worth your time to explore.

>
> Also, after "clear(arr)", will "arr ~= value" assign starting from element 0?

Yes


More information about the Digitalmars-d-learn mailing list