1

I was trying to learn something else then i encounter with the following code.

class point{}; point p_; new (&p_) point(w.p_);

What does third line expression do, and what is intended ? Does it helps us to save time while copying or something. And is p_ somehow allocated dinamically? // I'm so confused.

The place I encountered ->> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf //Second page of the document.

TuttyFruty
  • 13
  • 5
  • Placement new, innit. – Bathsheba Feb 02 '18 at 09:41
  • Do some research about *placement new*. [A good book should have it covered](https://stackoverflow.com/a/388282/440558). – Some programmer dude Feb 02 '18 at 09:41
  • It does not save time while copying, it does not allocate anything. The example code does not appear in the linked document. Last two expressions could be replaced by `point p_ = point(w.p_);` – eerorika Feb 02 '18 at 09:45
  • This is a fair question, but the example is very poor. The presence of the `union` is crucial but has been left out. – Quentin Feb 02 '18 at 09:47

0 Answers0