[EMCpp]Item-28 Understand Reference Collapsing
· ☕ 3 min read
Reference collapsing occurs in four contexts: template instantiation, auto type generation, creation and use of typedefs and alias declarations, and decltype.
[EMCpp]Item-27 Alternatives to Overloading on Universal References
· ☕ 5 min read
Universal reference parameters often have efficiency advantages, but they typically have usability disadvantages.
[EMCpp]Item-26 Avoid Overloading on Universal References
· ☕ 4 min read
Overloading on universal references almost always leads to the universal reference overload being called more frequently than expected.
[EMCpp]Item-25 Use std::move on Rvalue References, std::forward on Universal References
· ☕ 4 min read
But don’t apply std::move
or std::forward
to local objects if they would otherwise be eligible for the return value optimization.