December 21, 2014
https://issues.dlang.org/show_bug.cgi?id=13885

safety0ff.bugz <safety0ff.bugz@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz@gmail.com

--- Comment #1 from safety0ff.bugz <safety0ff.bugz@gmail.com> ---
Implementing this would mean adding a field to byValue / byKey Result range struct which subtracts 1 from the field on each popFront.

I'm not convinced there's enough motivation for this feature.

// example of an alternative
import std.range;
auto knownLength(Range) (auto ref Range rng, size_t len)
    if (isInputRange!Range)
{
    static struct Result
    {
        Range r;
        size_t length;
        alias r this;
        auto popFront()()
        {
            --length;
            r.popFront();
        }
        @property bool empty()()
        {
            assert(!length == r.empty);
            return !length;
        }
    }
    return Result(rng, len);
}

void main() {
    int[int] aa;
    auto bykey = aa.byKey.knownLength(aa.length);
    auto byval = aa.byValue.knownLength(aa.length);
}

--
December 25, 2014
https://issues.dlang.org/show_bug.cgi?id=13885

bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from bearophile_hugs@eml.cc ---
(In reply to safety0ff.bugz from comment #1)

> I'm not convinced there's enough motivation for this feature.

I agree, I close down this ER.

--