On 08/27/12 00:31, Philippe Sigaud wrote: > On Sun, Aug 26, 2012 at 11:58 PM, Artur Skawina <[email protected]> wrote: > >> template staticIndexOf(T, TS...) { >> enum staticIndexOf = { >> foreach(size_t i, I; TS) >> static if (is(typeof(T == I)) && is(T == I)) >> return i; >> return -1; >> }(); >> } > > Is the is(typeof(T == I)) really necessary? If T == I is an error, > then is() returns false, or am I mistaken? >
It didn't look necessary to me either; i took the condition verbatim from Andrej's example. Removing the check made no difference to performance, so i kept it to minimize the diff between both versions. artur
