On Wednesday, 12 October 2016 at 16:57:50 UTC, Meta wrote:
//A template function's .stringof is of the format <function name>(<template args>)(<function args>) //so match on the number of brackets to determine whether it's a template function or not
enum isTemplateFunction = __traits(isTemplate, f)
                              && fstr.balancedParens('(', ')')
                              && (fstr.canFind("if")
                                  || fstr.count!(c =>
cast(bool)c.among!('(', ')')) == 4);


Whoops, I forget to say that fstr is defined like this:

enum fstr = f.stringof;

Reply via email to