Erroneous "auto can only be used for template function parameters"?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 20 18:26:49 PDT 2015


On Saturday, 20 June 2015 at 01:50:11 UTC, Yuxuan Shui wrote:
> auto ref R) is indeed a template function, so I don't 
> understand.

But R is not a parameter on the function itself. It comes from 
the outside template.

Move it to the inside template, rewrite it as:

	auto a(S, R)(auto ref R i) {
		return cast(S)i*2;
	}

and you should get further.


More information about the Digitalmars-d-learn mailing list