staticIndexOf is incredibly slow and memory intensive

Philippe Sigaud philippe.sigaud at gmail.com
Sun Aug 26 15:31:31 PDT 2012


On Sun, Aug 26, 2012 at 11:58 PM, Artur Skawina <art.08.09 at gmail.com> 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?


More information about the Digitalmars-d mailing list