C#'s greatest mistakes
"Jérôme M. Berger"
jeberger at free.fr
Sun Nov 28 04:43:47 PST 2010
Jonathan M Davis wrote:
> A clearer way to create such template constraints would definitely be nice. But
> aside from the fact that I'd absolutely hate to see interfaces be conflated with
> template constraints in this manner, you'd need a way to deal with the fact that
> the parameters and return types for such functions are frequently dependent on
> the type that the template is being instantiated with. A concept as you describe
> it would have to somehow take templated types into account in a way that
> interfaces can't. For instance, you could never define an interface which defined
> a forward range like isForwardRange!() does because the interface wouldn't be
> properly templatized.
>
Why not?
==============================8<------------------------------
concept FooBar(U)
{
int foo (int);
bool bar (U);
}
template Test(T, U) if (is!(FooBar!U, T)) ...
------------------------------>8==============================
This already works with class and interface templates...
Jerome
--
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101128/26d2eb14/attachment.pgp>
More information about the Digitalmars-d
mailing list