3 Mar
2019
3 Mar
'19
6:05 p.m.
Gottlob Frege wrote:
And do you sometimes do the opposite order - memcpy *this to a temporary, emplace into this, memcpy back from the temporary if emplace failed?
No, I don't do this. This is a trick that gets us close to the strong guarantee, but not all the way, so it's not worth doing. There are more evil variations, such as memcpy *this, emplace, if failed memcpy back, if not failed memcpy the new *this into another temp, memcpy the original back, invoke destructor, memcpy the new temp back. Totally undefined, of course, but could have worked in practice before compilers started getting clever with their lifetime tracking.