
Jaakko Jarvi <jajarvi@cs.indiana.edu> writes: | > Isn't it useful to have a way to specify whether the argument is to be | > passed by value, reference, const reference, etc. ? | | This has been brought up in the standards committee | (use of auto as a parameter type defines a template implicitly), | not for lambdas but for normal named functions. You're right that is not part of any formal proposal but if you ask the other co-author of decltype/auto proposal, he would tell you that he had been playing with that idea for sometime now :-) (Since at least the first version of that proposal :-)) As I commented last week, I would like to see the proposal to go a step further and allows type inference that can refer to local classes, e.g: operator*: (const auto& x, const auto& y) -> auto { using lhs_type = decltype(x); using rhs_type = decltype(y); struct dot { lhs_type lhs; rhs_type rhs; dot(lhs_type l, rhs_type r) : lhs(l), rhs(r) { } // evaluation on demand operator(): (auto x) const -> auto { return lhs(x) * rhs(x); } }; return dot(x, y); } (It would be even better if we could get "concepts", but that is a different story). E.g. I would like to see less needs for clumsy/brittle constructs needed to support expression templates that some domain specific libraries seem to require. -- Gaby