Checking if a function exists

Max Samukha samukha at voliacable.com
Wed Feb 21 12:55:20 PST 2007


On Wed, 21 Feb 2007 21:25:20 +0100, Michiel <nomail at please.com> wrote:

>I'm not quite sure how to do this, but I'm sure one of you does. I need
>something like:
>
>static if ( functionExists(char[] .toString(T)) ) { ... }
>
>static if ( functionExists(char[] T.toString()) ) { ... }
>
>What is the real way to do this static check?
>
>Thanks!

The way that I can think of is

static if (is(typeof(&T.toString) == char[] function()))

There might be others



More information about the Digitalmars-d mailing list