"cannot deduce function from argument types" issue.

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 10 01:02:53 PST 2015


On 02/10/2015 12:31 AM, ted wrote:

 > ElementType!R testFunc(R)( R range, ElementType!R foo)	// compiles with
 > double foo

If think it is a little too much to ask from the template system of D. A 
proper way of doing the same thing is to use a template constraint:

ElementType!R testFunc(R, E)( R range, E foo)
     if (is (E : ElementType!R))

Ali



More information about the Digitalmars-d-learn mailing list