Annoying thing about auto ref function template
Yuxuan Shui via Digitalmars-d
digitalmars-d at puremagic.com
Mon Mar 20 12:49:03 PDT 2017
An auto ref function template should behave like a normal
function template, but it doesn't.
You can fully instantiate a function template by specifying all
of its template parameters, but you can't do that with auto ref
templates. The only way to instantiate an auto ref template is to
call it.
This makes auto ref an outlier. Because you get a function by
instantiate function template, you can pass the result as
template alias argument, and you can create alias of the
resulting function. And you can't do that with an auto ref
template, which makes them quite annoying.
I wonder why is auto ref designed this way? And can we change
this?
More information about the Digitalmars-d
mailing list