Bug 2903 – Splitter should be bi-dir if the input range is bi-dir
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2009-04-26T21:30:00Z
Last change time
2015-06-09T01:26:25Z
Assigned to
andrei
Creator
braddr
Comments
Comment #0 by braddr — 2009-04-26T21:30:54Z
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.