3 ms·
No, you should almost never use std::move. Instead, the parameters should be "const std::string&". This way, you avoid all the unnecessary copies and moves.
by Noughmad 10y ago
No, you should almost never use std::move. Instead, the parameters should be "const std::string&". This way, you avoid all the unnecessary copies and moves.
- silent_hunter 10y ago"const string&" - will always make a copy of the string for first_name and last_name, if we write "Person(std::string first_name, std::string last_name) : first_name(first_name) , last_name(last_name) {}" in case passed arguments are lvalues they will be copied, otherwise moved.