Showing a user specified error message when no overloads match

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 26 10:14:44 PDT 2014


Hmmm... thinking about it, is this possible?

1. Remove the constraints to match anything.
2. Inside the template, have some construct that enumerates all 
possible overloads and UFCS functions that are visible at the 
point of instantiation.
3. If this set contains only the current template, use a static 
assert to print the message.
4. Otherwise, make the template fail to compile somehow (for 
example, evaluate a semantically invalid expression), and hope 
that the compiler will then take the other overloads into 
consideration (SFINAE).

Could this work?


More information about the Digitalmars-d-learn mailing list