How to distinguish a delegate from a function?

Bill Baxter dnewsgroup at billbaxter.com
Sat Jul 12 14:03:53 PDT 2008


Moritz Warning wrote:
> I try to check (at compile time) if an expression need to be called with a
> context pointer or without.
> 
> E.g.: I want to tell the difference between A.foo (no context pointer 
> needed) and A.bar.
> 
> class A
> {
>    static void foo() {}
>    void bar() {}
> }
> 
> Any ideas?

I think these work:
static if(is(xxx == function))
static if(is(xxx == delegate))

--bb



More information about the Digitalmars-d mailing list