February 21, 2007
Max Samukha wrote:

>> For all types you can use T.init as the dummy value to the function (I just remembered its existence).
> 
> This works for module scope functions:
> 
> static if (is(typeof(&.toString) == char[] function(T))) // '.' is the
> module scope operator or use fully qualified name. Trickier ways might
> exist.

That doesn't work if there are multiple overloads of the same function, like with toString. I just tested it.

Tyler's method worked, though.

Thanks!

-- 
Michiel
February 21, 2007
Tyler Knott wrote:
> For all types you can use T.init as the dummy value to the function (I just remembered its existence).

Doesn't work for static arrays IIRC, since typeof(T[N].init) == T (for constant integer N)...
February 22, 2007
On Wed, 21 Feb 2007 23:08:16 +0100, Michiel <nomail@please.com> wrote:

>Max Samukha wrote:
>
>>> For all types you can use T.init as the dummy value to the function (I just remembered its existence).
>> 
>> This works for module scope functions:
>> 
>> static if (is(typeof(&.toString) == char[] function(T))) // '.' is the
>> module scope operator or use fully qualified name. Trickier ways might
>> exist.
>
>That doesn't work if there are multiple overloads of the same function, like with toString. I just tested it.
>
>Tyler's method worked, though.
>
>Thanks!

Yes, my mistake
1 2
Next ›   Last »