template instantiation --- having trouble therewith

Carl Sturtivant sturtivant at gmail.com
Tue Sep 3 04:51:35 PDT 2013


>
> I'm confused as to what you're trying to do... your example 
> code is equivalent to
>
>   import std.stdio;
>   int x = 3;
>   int scale( int s) { return x * s; }
>   auto f = &scale;
>   writeln( f(7) );

No it isn't according to dmd.

My code is a minimal piece that produces the same error as some 
real code. The higher order generic function muddle in the real 
code is supposed to transform one delegate into another, but I 
still get the template problem if muddle is the identity function 
(given here).

My example code isn't equivalent to the above according to the 
compiler. Why is that? And how can I make it work?


More information about the Digitalmars-d-learn mailing list