digitalmars.D.learn - Emptying D Arrays and std.container.Arrays
- "Per =?UTF-8?B?Tm9yZGzDtnci?= <per.nordlow gmail.com> (9/9) Feb 16 2015 Is there a specific function in to empty a builtin D array or
- Tobias Pankrath (2/12) Feb 16 2015 You can set the length to zero for both.
- "Per =?UTF-8?B?Tm9yZGzDtnci?= <per.nordlow gmail.com> (6/7) Feb 16 2015 Thanks.
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.
Feb 16 2015
On Monday, 16 February 2015 at 16:56:15 UTC, Per Nordlöw wrote:
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.
You can set the length to zero for both.
Feb 16 2015
On Monday, 16 February 2015 at 17:00:39 UTC, Tobias Pankrath wrote:You can set the length to zero for both.Thanks. I believe C++ programmers would find a tiny wrapper function, say clear(), in std.algorithm or perhaps even D array builtin for this nice from a portability point of view.
Feb 16 2015








"Per =?UTF-8?B?Tm9yZGzDtnci?= <per.nordlow gmail.com>