C#'s greatest mistakes

Steven Schveighoffer schveiguy at yahoo.com
Mon Nov 29 05:25:16 PST 2010


On Sat, 27 Nov 2010 10:59:42 -0500, Torarin <torarind at gmail.com> wrote:

> 2010/11/27 Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:
>> We use template constraints for that kind of stuff.
>>
>> Andrei
>>
>
> Yes, and that's great, but is there a way to check whether a template
> argument matches a defined interface?

We have stuff like isInputRange!R.

It's exactly what you want, but you have to do a bit more work.

I would expect in about 1-2 days some template guru will come up with:

implements!(T, U)

which does all the boilerplate work of trying to see if U can be  
substituted anywhere T is used.

-Steve


More information about the Digitalmars-d mailing list