Determining if a symbol is a function

bearophile bearophileHUGS at lycos.com
Sun Apr 12 14:48:54 PDT 2009


Doctor J:
>     static if (is(typeof(func0) == function))
>         writefln("func0 is a function.");
> is() really wants a type, not an expression.

What you may want is to test if a type is a callable (function, delegate or object with opCall).
See IsCallable here:
http://www.fantascienza.net/leonardo/so/dlibs/templates.html

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list