3 ms·
You are correct. A trivial copy assignment operator makes a copy of the object representation as if by std::memmove. All data types compatible with the C langua
by lenkite 7y ago
You are correct. A trivial copy assignment operator makes a copy of the object representation as if by std::memmove. All data types compatible with the C language (POD types) are trivially copy-assignable.
https://en.cppreference.com/w/cpp/string/byte/memmove https://en.cppreference.com/w/cpp/string/byte/memmove
- rurban 7y agoNot memmove. A trivial object assignment can be _memcpy_aligned, which is much faster. And the size is compile-time constant.
- lenkite 7y agoI assume you mean aligned on boundaries ? I picked up that from https://en.cppreference.com/w/cpp/language/copy_assignment https://en.cppreference.com/w/cpp/language/copy_assignment and it does also say that memmove has a fallback to std::memcp when there is no overlap between source and destination.