Modern pattern for storing constructor arguments:
class UserProfile {
std::string m_name;
std::vector<int> m_scores;
public:
// Pass by value, then move into member
UserProfile(std::string name, std::vector<int> scores)
: m_name(std::move(name)), m_scores(std::move(scores)) {}
};If caller passes an rvalue (UserProfile("Alice", {10, 20})), the arguments are constructed once and moved twice with zero deep copies! Avoids having to write separate lvalue and rvalue constructor overloads.