delete an element from an array

Adam Cigánek adam.ciganek at gmail.com
Sun Oct 24 04:02:24 PDT 2010


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.


adam.


More information about the Digitalmars-d-learn mailing list