How about "auto" parameters?

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Jun 3 09:36:46 PDT 2011


On 6/3/11, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> (unrestricted templates are black holes that accept
> everything but then fail to compile with unintuitive error messages and
> loci).

Agreed for that point, but as a templated function gets several
constraints it's impossible to figure out which constraint failed just
by looking at the error message. The only thing you ever get back is:
"<complex template declaration> does not match any function template
declaration"
"<complex template declaration> cannot deduce template function from
argument types <your arguments here>"

You get to see which arguments you've passed, but not which of the
constraints failed. If you wrote the template it might be easy to
figure out that you can't pass a certain type of argument, but if you
didn't write it it's hard to figure out what went wrong.


More information about the Digitalmars-d mailing list