On Sun, 24 Oct 2010 13:02:24 +0200, Adam Cigánek <[email protected]> wrote:

Hello,

Is there a function in the standard library to delete an element from
an array (or range)? Something like:

  auto a = [1, 2, 3, 4, 5, 6];
  auto b = delete(a, 4);

  assert([1, 2, 3, 4, 6] == b);

I've noticed there is eliminate in std.algorithm, which seems to be
doing just that, but it's commented out.

It's not difficult to roll my own, (with the help of indexOf and
remove), but I thought that this is pretty common operation so it
should be in the standard library.

std.algorithm has remove, which does what you want.

--
Simen

Reply via email to