On Thursday, 1 September 2016 at 17:21:02 UTC, Meta wrote:
I just thought of this, but cannot test if it works. If it
does, maybe it would be a suitable solution?
void f(T)(T t) if(isSomething!T) {}
void f(T)(T t) if(isSomethingElse!T) {}
//Taken if no other "overload" of f will intantiate with the
given T
void f(T)(T t) if(!__traits(compiles, alias _ = .f!T)) {}
That's so dirty, I love it. I imagine if __traits(getOverloads
worked for templates we could actually use this pretty reliably
(by excluding the fallback template from the search).