Implicit conversion from array of class to array of interface
Phil Deets
pjdeets2 at gmail.com
Sun Dec 13 01:25:12 PST 2009
On Sun, 13 Dec 2009 04:08:19 -0500, Phil Deets <pjdeets2 at 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/
More information about the Digitalmars-d-learn
mailing list