> On 08/03/2017 09:17, Gerry Boland wrote:
> > + auto extraWindowInfo = getExtraInfo(windowInfo);
> > const auto & <- to save a copy?
>
> Are you sure? getExtraInfo() returns a std::shared_ptr<>. Won't move
> semantics take care of that?
The times that 'const auto&' gains over 'const auto' are mostly those when the function returns a reference.
For any function that returns a type (i.e. not a reference) it is very likely that RVO "takes care of it" and invoking move semantics would actually be less efficient.
> On 08/03/2017 09:17, Gerry Boland wrote: windowInfo) ;
> > + auto extraWindowInfo = getExtraInfo(
> > const auto & <- to save a copy?
>
> Are you sure? getExtraInfo() returns a std::shared_ptr<>. Won't move
> semantics take care of that?
The times that 'const auto&' gains over 'const auto' are mostly those when the function returns a reference.
For any function that returns a type (i.e. not a reference) it is very likely that RVO "takes care of it" and invoking move semantics would actually be less efficient.