Checking if a function exists

Max Samukha samukha at voliacable.com
Wed Feb 21 23:53:00 PST 2007


On Wed, 21 Feb 2007 23:08:16 +0100, Michiel <nomail at 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



More information about the Digitalmars-d mailing list