3 ms·
I think the main motivation for adding move semantics to c++11 was performance. Ie. Eliminate superfluous copy constructors when passing a std::string temporary
by repelsteeltje 2y ago
I think the main motivation for adding move semantics to c++11 was performance. Ie. Eliminate superfluous copy constructors when passing a std::string temporary into a function.
Std::move, std::forward are neat, though somewhat cumbersome compared to Rust. C++ scope, lifetime plus the fact that std::move doesn't actually move are real footguns.
There have been attempts to add destructive moves (Circle) but it's a long way from Rust's ergonomics.
I concur with op that default move semantic is where rust shines.