On Friday, 6 September 2013 at 17:15:03 UTC, H. S. Teoh wrote:
Hmm, could this be a possible (though somewhat ugly) workaround?

        foreach (T; IntegralTypeList)
        {
                assert(factorial(to!T(3) == 6));
        }

AFAIK, if T==int, then std.conv.to should simply alias itself away. And it *should* be able to handle ctors that take the requisite type, I
think.

I use:

        foreach (T; IntegralTypeList)
        {
                assert(factorial(cast(T)3) == 6));
        }

I works, but looks a little strange.
I belive that compiler should optimise this (do nothing), but I am not sure.

Reply via email to