template instantiation --- having trouble therewith

Manfred Nowak svv1999 at hotmail.com
Tue Sep 3 14:52:58 PDT 2013


Carl Sturtivant wrote:
> is supposed to transform one delegate into another

Then please declare the template parameters to be delegates:

U muddle( T, U)( T f) {
	uint g( int fp){
		return cast(uint)( 5* f( fp));
        }
	auto gP= &g;
	return gP;
}

unittest {
     import std.stdio;
	      int x = 3;
	    int scale( int s) { return x * s; }
	  auto f= muddle!( int delegate( int), uint delegate( int))( &scale);
	writeln( f(7));
}
// no deduction problems

-manfred


More information about the Digitalmars-d-learn mailing list