On Monday, December 24, 2012 02:41:41 Namespace wrote: > > Plenty of people are using it with the problems that it > > currently has > > But how long? > > For the moment (or the next 2, 3 releases) it should be enough if > I write > void foo()(auto ref const Foo f) { > instead of > void foo(ref const Foo f) { > > or is there any difficulty? After all it's a template now.
If you templatize a function, then you can use auto ref with it, and auto ref functions will work with both lvalues and rvalues without copying either. It basically creates two overloads - a ref and non-ref version. The ref version takes lvalues and obviously won't make copies. The non-ref version _might_ copy but shouldn't, because the compiler will generally move rvalues values rather than copying them. - Jonathan M Davis