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

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from [email protected] ---
Is there a use case for this outside of string formatting?

Also, does it justify having a new range, when the same end result could be had
with chain and repeat?

auto padLeft(R, E)(R r, E e, size_t n)
{
    return chain(repeat(e, n > r.length ? n - r : 0), r)
}

For padLeft, I'm making the assumption that r is random access. If we want to
accept forward range (input is not possible), then we have to use
r.save.walkLength(), presuming the extra complexity is acceptable.

The only case where your proposal could make sense, is for padRight on a pure
input range (no length, no save). But that's one hell of a particular case...

--

Reply via email to