On Tuesday, 2 September 2014 at 11:41:51 UTC, Nordlöw wrote:
On Tuesday, 2 September 2014 at 10:22:49 UTC, monarch_dodra wrote:
the fastest way to do this?

Are you talking about constraints, or implementation of safeSkipOver?

The constraint.

In that case, I'm not sure what you mean by "fastest" in the context of "constraints", which are compile-time.

Hum... Are you writing this function because skipOver will actually fail? AFAIK, it shouldn't. We should fix skipOver...

Yes, I'm writing this wrapper because call to r.front in

bool skipOver(alias pred = "a == b", R, E)(ref R r, E e)
if (is(typeof(binaryFun!pred(r.front, e))))
{
    if (!binaryFun!pred(r.front, e))
        return false;
    r.popFront();
    return true;
}

fails when r is empty.

It believe it should be

    if (r.empty || !binaryFun!pred(r.front, e))

right? Should I do a PR?

I think so yes. That's the "R/E" version though. Is the "R/R" version also subject to this issue?

Reply via email to