Emptying D Arrays and std.container.Arrays

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 16 08:56:14 PST 2015


Is there a specific function in to empty a builtin D array or 
should I just do

     auto x = [1,2,3];
     x = [];

I'm asking because std.container.Array has the member .clear() 
and I would like my code to compatible with both builtin arrays 
and std.container.Array. If not is there an con to using x = [] 
for std.container.Array aswell?

I can't find any clear() function in std.algorithm nor std.range.


More information about the Digitalmars-d-learn mailing list