Does D support nested Templates aka Higher Kinded Polymorphism?

Adam D. Ruppe destructionator at gmail.com
Tue Oct 3 13:45:33 UTC 2017


On Tuesday, 3 October 2017 at 13:31:00 UTC, sighoya wrote:
> struct Bar (R,S) {

> T!(S!R) bar(alias T,alias S,R)(T!(S!R) v) {return v;}

Bar takes two arguments, but here you are only passing one. Keep 
in mind that T!(...) is Bar. You called T!(S!(R)) when it was 
actually written to accept T!(S, R)


It might help to forget about the ! and just think of regular 
functions.

Bar(R, S); is the definition

but inside you called

T(S(R))

when it expected

T(S, R)


More information about the Digitalmars-d-learn mailing list