| ▲ | cv5005 6 hours ago | |
One reason is that c++ still hasn't gotten 'trivial relocatability' right - i.e being able to memcpy/memmove and not have to call constructors/destructors when growing your vector class. | ||
| ▲ | Panzerschrek 6 hours ago | parent | next [-] | |
Actually, issues with non-trivial moves and relocations are specific only for C++. Some other languages (notably Rust and Swift) don't have such issues, but still have nice automatic memory management via destructors and containers atop of it. | ||
| ▲ | Panzerschrek 6 hours ago | parent | prev | next [-] | |
C++ compilers optimize-out empty destructor calls and sometimes even replace calls to move constructors/move assignment operators via memcpy. But it's unfortunately not guaranteed in all cases due to constrains of the C++ object/memory model designed initially without proper move semantics. | ||
| ▲ | tardedmeme 3 hours ago | parent | prev [-] | |
std::is_trivially_copyable says hi | ||