www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12086] New: std.algorithm.remove + range of indices produces wrong results

https://d.puremagic.com/issues/show_bug.cgi?id=12086

           Summary: std.algorithm.remove + range of indices produces wrong
                    results
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: justin economicmodeling.com


--- Comment #0 from Justin Whear <justin economicmodeling.com> 2014-02-05
12:52:34 PST ---
While the documentation for std.algorithm.remove does not mention using a range
of indices, it quietly accepts such.  Given that std.algorithm deals
extensively in ranges, there is an implicit expectation that a range of indices
should work--an expectation that is confirmed by the fact that such a usage of
remove both compiles and runs.

---------------------------------------
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  -- incorrect
}
---------------------------------------

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 05 2014