On Wednesday, 12 October 2016 at 16:57:50 UTC, Meta wrote:
There's also a *very* ugly hack you can do:

//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);

This won't work if there are additional parens _inside_ compile/runtime parameters, though, which there is ample opportunity for:

T func(T : U!(int, string), U)(const(T) param = defaultValue!(const(T))());

Reply via email to