[Issue 12086] std.algorithm.remove + range of indices produces wrong results
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jun 11 07:31:10 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12086
safety0ff.bugz <safety0ff.bugz at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |safety0ff.bugz at gmail.com
--- Comment #1 from safety0ff.bugz <safety0ff.bugz at gmail.com> ---
I think this is a combination of a documentation bug and a remove bug:
The documentation bug is that it should accept any range of indices with length
1 or 2.
Currently it is only documented that tuples of length 2 should be accepted, but
I don't see why tuples should be special.
Secondly:
import std.stdio, std.algorithm;
void main(string[] args)
{
writeln( [0,1,2,3,4].remove(1, 3) );
// 0, 2, 4 -- correct
writeln( [0,1,2,3,4].remove([1, 3]) );
// 0, 3, 4 -- correct
writeln( [0,1,2,3,4].remove(tuple(1,3)) );
// 0, 3, 4 -- correct
writeln( [0,1,2,3,4].remove([1,3,4]) ); // should error on invalid args
// 0, 3, 4 -- incorrect
writeln( [0,1,2,3,4].remove(tuple(1,3,4)) ); // should error on invalid
args
// 0, 3, 4 -- incorrect
}
--
More information about the Digitalmars-d-bugs
mailing list