Should all/most setter functions in C++11 be written as function templates accepting universal references?

You know the classes A and B, so you know if they are movable or not and if this design is ultimately necessary. For something like std::string, it’s a waste of time changing the existing code unless you know you have a performance problem here. If you’re dealing with auto_ptr, then it’s time to rip … Read more

Is there a difference between universal references and forwarding references?

Do they mean the same thing? Universal reference was a term Scott Meyers coined to describe the concept of taking an rvalue reference to a cv-unqualified template parameter, which can then be deduced as either a value or an lvalue reference. At the time the C++ standard didn’t have a special term for this, which … Read more