←back to thread

178 points todsacerdoti | 4 comments | | HN request time: 0.205s | source
1. choeger ◴[] No.26340875[source]
Why is there no move_back(), I wonder?
replies(2): >>26341048 #>>26341059 #
2. lgeorget ◴[] No.26341048[source]
Well that's emplace_back() or push_back() when you pass them a r-value reference basically.
3. pornel ◴[] No.26341059[source]
Rust's push is a `move_back`. Curiously, it doesn't have any equivalent of emplace or placement new. It does memcpy on push, and relies on the optimizer to remove it.
replies(1): >>26341702 #
4. __s ◴[] No.26341702[source]
Rust gets away with this because it doesn't have move constructors. Which is a pain if you want self referencing structures, but avoids quite a bit of complexity