2 problems I can't get my head around

Adam D. Ruppe destructionator at gmail.com
Mon Nov 26 08:44:32 PST 2012


On Monday, 26 November 2012 at 16:32:17 UTC, Manu wrote:
> And fail! functionAttributes breaks when I pass basically 
> anything that's not a function >_<

Blargh.. they do that purposefully to, there's a check 
if(isCallable!T) on the thingy.


You could use that same check though: if !isCallable!T, it cannot 
be a property right now, so no need to do the other check.


template isProperty(T) if(isCallable!T) {
    enum bool isProperty = (functionAttributes!T & 
FuncAttribute.property) ? true : false;
}

template isProperty(T) if(!isCallable!T) {
    enum bool isProperty = false; // it isn't callable, so can't 
be a property
}


More information about the Digitalmars-d mailing list