On Sunday, January 27, 2013 10:47:42 Namespace wrote: > Ehh, so if auto ref won't be the solution, we then have auto ref > for template functions and another solution for non-ref > functions? I don't think that that is a smart idea and that it > would be a kind of inconsistent.
I don't know what solution we're going to get. And auto ref for templates actually serves another purpose other than trying to avoid unnecessary copies in that it apparently helps with attempts at perfect forwarding (though I don't remember the details, since I haven't used it for that). It's an accidental benefit of auto ref (the whole idea behind it in the first place was to deal with the const& problem), but it means that auto ref on templated functions is valuable regardless of what happens with non-templated functions. And has been pointed out, the proposed solution for auto ref and non-templated functions (that is, have the compiler create a variable to assign an rvalue to and then pass that to the function) would arguably be desirable with templated functions as well (in order to reduce code bloat), so it's arguably better to pick something other than auto ref so that it can be used for both templated and non-templated functions. Regardless, I can't comment on what the final solution is going to be, because I don't know what it's going to be. And moving forward with an implementation that we may just throw away would be a mistake. So, we're just going to have to wait for Andrei to finish his proposal so that it can be discussed and hopefully implemented once it's been fully vetted and fleshed out. - Jonathan M Davis