digitalmars.D.bugs - [Issue 17238] New: r.lookaround!(a, b) returns a range derived from
- via Digitalmars-d-bugs (26/26) Mar 01 2017 https://issues.dlang.org/show_bug.cgi?id=17238
https://issues.dlang.org/show_bug.cgi?id=17238 Issue ID: 17238 Summary: r.lookaround!(a, b) returns a range derived from r that allows a elements of lookahead and b elements of lookback Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: andrei erdani.com Inspired by https://github.com/dlang/phobos/pull/5153, a great range type would be one that offers fixed lookaround. It works like any other range but has supplemental functions for lookahead and lookback. r.lookahead!(a, b) yields a range looking up to a elements ahead and up to b elements back. These are accessible through two new APIs, e.g. ahead(k) and behind(k). If r is a random-access range, the resulting range does NOT copy any elements and simply provides APIs on top of the random access primitives. If r is weaker than random-access, it embeds a fixed-size buffer and moves through it with minimal effort. --
Mar 01 2017