Thread overview
clear()
Mar 25, 2011
Dr.Smith
Mar 28, 2011
Kai Meyer
Mar 29, 2011
Simen kjaeraas
March 25, 2011
To empty many arrays of various types, rather than:

clear(arr1);
clear(arr2);
...
clear(arrN);

is there something like:

clear(ALL);

Also, after "clear(arr)", will "arr ~= value" assign starting from element 0?
March 25, 2011
On Fri, 25 Mar 2011 15:10:44 -0400, Dr.Smith <iam@notfar.com> wrote:

> To empty many arrays of various types, rather than:
>
> clear(arr1);
> clear(arr2);
> ...
> clear(arrN);
>
> is there something like:
>
> clear(ALL);

Not sure what this would do.  Clear all arrays?  That isn't possible.

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

Yes.

-Steve
March 28, 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
March 29, 2011
On Mon, 28 Mar 2011 16:57:17 +0200, Kai Meyer <kai@unixlords.com> wrote:

> 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()

That should probably be

foreach ( a; ALL )
    clear( a );


-- 
Simen