[Issue 2903] New: Splitter should be bi-dir if the input range is bi-dir

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 26 19:30:46 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2903

           Summary: Splitter should be bi-dir if the input range is bi-dir
           Product: D
           Version: 2.029
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: braddr at puremagic.com


obviously there's 'better' ways of doing this, but use it an a contrived
example:

    string inputpath = "/a/b";

    auto parts = splitter(inputpath, "/");
    // parts is ["", "a", "b"]
    parts.popFront; // get rid of empty leading part
    auto file = parts.back;
    parts.popBack;
    writefln("file = %s", file);
    auto path = reduce!(q{a ~= "/" ~ b})("", parts);
    writefln("path = %s", path);

Problem: Splitter is strictly a forward range currently.


-- 



More information about the Digitalmars-d-bugs mailing list