Should all/most setter functions in C++11 be written as function templates accepting universal references?
Consider a class X with N member variables, each of some copiable and movable type, and N corresponding setter functions. In C++98, the definition of X would likely look something like this: class X { public: void set_a(A const& a) { _a = a; } void set_b(B const& b) { _b = b; } ... private: A _a; B _b; ... }; Setter functions of class X above can bind both to lvalue and to rvalue arguments. Depending on the actual argument, this might result in the creation of a temporary and will eventually result in a copy assignment; due to this, non-copiable types are not supported by this design. With C+