News for hackers. Stuff that matters.
Re:Short intro to C++ for Rust developers: Ownership and Bor... by Noughmad on Monday January 23, 2017 @03:10AM (#13460654)
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.
Re:Short intro to C++ for Rust developers: Ownership and Bor... by silent_hunter on Monday January 23, 2017 @07:16AM (#13461626)
"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.