More templated type argument inference

Philippe Sigaud philippe.sigaud at gmail.com
Thu Dec 6 08:09:34 PST 2012


Doesn't that mean you're asking the compiler to have a full unification
engine? Your example is simple, but the general case is more complicated:

void foo(T,U,V)(Tuple!(T,U) tup, V function(U) fun)
{ ... }

void main()
{
    foo(tuple(1,"abc"), (a) => 1.34); // so, I can deduce V to be double

    foo(tuple(1,"abc"), (int i) => i+); // error, U unified to string and
int!
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20121206/2dbf4baf/attachment.html>


More information about the Digitalmars-d-learn mailing list