On Sun, 13 Dec 2009 04:08:19 -0500, Phil Deets <pjdee...@gmail.com> wrote:

I found another workaround which doesn't require a bunch of extra overloads. I'll probably update it to use that template someone wrote in that thread about static duck-typing.

I looked up this post. It was: "Re: static interface" by Simen kjaeraas at Thursday, November 19, 2009 6:47:08 AM.

By the way, how do I move the bool specialization into the general function?

void f(T)(T param)
{
        static if (__traits(compiles, param[0].h()))
        {
                // do I[] overload here
        }
        else static if (T is bool) // how do I do this?
        {
        }
        else
        {
                pragma(msg, "Unsupported type for f.")
                static assert(0);
        }
}

I figured it out; it's:

else static if (is(T == bool))

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Reply via email to