On Thursday, 1 October 2015 at 22:37:57 UTC, Ali Çehreli wrote:
Very quickly:import std.traits; template allSame(V...) if (isExpressions!(V)) { bool impl_(V...)() { static if (V.length > 1) { foreach (i, _; V[0 .. $ - 1]) { if (V[i] != V[i + 1]) { return false; } } return true; } else { return true; } } enum allSame = impl_!V(); }
Will this spare memory in DMD? If so there are a few traits that should be update accordingly, for instance `allSatisfy` and `anySatisfy`.
Thanks!