On Tuesday, 26 May 2015 at 05:54:11 UTC, John Colvin wrote:
Something like this appears to work:

import std.typetuple : allSatisfy;

enum implicityConvertibleToBool(T) = is(T : bool);

bool tok_and(Args...)(lazy Args terms)
if(allSatisfy!(implicitlyConvertibleToBool, Args))
{
        auto backup = getInputLocation();
        foreach(term; terms)
        {
                if(term == false)
                {
                        rewind(backup);
                        return false;
                }
        }
        return true;
}

Hmmm.... this does seem to work. Does this essentially expand out to tok_and(lazy bool arg1, lazy bool arg2, ...)?

Reply via email to