4 ms·
Why is there no move_back(), I wonder?
by choeger 6y ago
Why is there no move_back(), I wonder?
- lgeorget 6y agoWell that's emplace_back() or push_back() when you pass them a r-value reference basically.
- pornel 6y agoRust'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.
- __s 6y agoRust 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