Given an allocated but uninitialized memory location, how do I move some object into that location (destroying the original), without constructing potentially expensive intermediate objects?
Given an allocated but uninitialized memory location, how do I move some object into
Share
You could use placement new to move-construct it in the memory:
If it has a non-trivial destructor, then you’ll need to explicitly destroy it when you’re done: