[Issue 12086] std.algorithm.remove + range of indices produces wrong results

2018-06-13 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12086

--- Comment #4 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/622c5d209820194651a8acb01fabc03041cd8e9e
Fix Issue 12086 - std.algorithm.remove + range of indices produces wrong
results

https://github.com/dlang/phobos/commit/89c1f1af6f29500013c465cc53f12e1ec6221523
Merge pull request #6154 from wilzbach/fix-12086

Fix Issue 12086 - std.algorithm.remove + range of indices produces wrong
results
merged-on-behalf-of: Nathan Sashihara 

--


[Issue 12086] std.algorithm.remove + range of indices produces wrong results

2018-02-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12086

Seb  changed:

   What|Removed |Added

   Keywords||pull
 CC||greensunn...@gmail.com

--- Comment #3 from Seb  ---
PR https://github.com/dlang/phobos/pull/6154

--


[Issue 12086] std.algorithm.remove + range of indices produces wrong results

2014-06-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12086

--- Comment #2 from safety0ff.bugz  ---
(In reply to safety0ff.bugz from comment #1)
> 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.

Reflecting about this I realised that it is error prone, so tuples should be
the only way to specify a range of indices.
I think to fix this a relatively short deprecation cycle should be introduced
to avoid breaking code.

--


[Issue 12086] std.algorithm.remove + range of indices produces wrong results

2014-06-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12086

safety0ff.bugz  changed:

   What|Removed |Added

 CC||safety0ff.b...@gmail.com

--- Comment #1 from safety0ff.bugz  ---
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
}

--