www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14543] New: std.algorithm.searching.until does not handle

https://issues.dlang.org/show_bug.cgi?id=14543

          Issue ID: 14543
           Summary: std.algorithm.searching.until does not handle range
                    sentinels nicely
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: jakobovrum gmail.com

Current behaviour:

void main()
{
    import std.algorithm;
    assert("one two three".until("two", OpenRight.no).equal("one t"));
}

It's probably safe to say the user expected the result to be equal "one two".
Range sentinel values aren't in the tests, so it's probably safe to say `until`
was not designed with range sentinels in mind.

--
May 04 2015