Compile-Time Interfaces (Concepts)

bossfong via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 23 07:21:16 PDT 2014


Could we possibly have a template like the following:

satisfiesInterface!(T, Interface);

that would return true when T satisfies Interface and otherwise gives 
descriptive error messages via __pragma(error, ...) ?

Then isInputRange could simply use satisfiesInterface under the hood and 
user code had a nice tool to check their very own requirements.
I'm not sure if such a template is possible though.


More information about the Digitalmars-d-learn mailing list