On Saturday, 10 March 2018 at 18:26:48 UTC, Simen Kjærås wrote:
Is there a way to break the `static foreach` loop prematurely as quickly as `allSameTypeIterative` becomes false?

Sure:

@property
bool allSameTypeIterative(V...)()
//if (allSatisfy!(isType, V))
{
    foreach (Vi; V)
        if (Vi != V[0]) return false;
    return true;
}

No, it's not quite the same, but it's easier to read and gives the same result.

--
  Simen

That will trigger CTFE, but I'm trying to avoid that.

Reply via email to