[Issue 17238] r.lookaround!(a, b) returns a range derived from r that allows a elements of lookahead and b elements of lookback

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Mar 1 17:39:50 PST 2017


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

greenify <greeenify at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greeenify at gmail.com
           Assignee|nobody at puremagic.com        |greeenify at gmail.com

--- Comment #1 from greenify <greeenify at gmail.com> ---
A couple of questions to clarify:

1) popFront/popBack will move the fixed-size buffer, right?
For example:

10.iota.ahead(3).drop(2).writeln; // [2, 3, 4]

2)
> it embeds a fixed-size buffer and moves through it with minimal effort.

It's assumed are only shallow which can change?

auto arr = 10.iota.ahead(3);
auto a = arr[1..$]; // [1, 2]
arr.popFront;
auto b = arr[1..$]; // [2, 3]

With "minimal effort" a would be [2, 3] as well.

3) Should there be ahead!3 to allow using a static array as buffer in order to
avoid allocation?

4) Should there be support for providing your custom allocator for the runtime
flag to allow GC-free behavior?

--


More information about the Digitalmars-d-bugs mailing list