On Wednesday, 22 March 2017 at 08:57:34 UTC, ANtlord wrote:
On Wednesday, 22 March 2017 at 06:47:26 UTC, Ali Çehreli wrote:
On 03/21/2017 09:57 PM, ANtlord wrote:
> Thank you for clarification. But I have one more question. Do
I have to
> use destroy for deallocating object from stack?
Yes because what is going out of scope are two things:
- A buffer
- A MyClass reference
Oh I got it. I have to use `destroy` in this case. If I use
`scope` I haven't buffer and MyClass reference then I can don't
use `destroy`. Do I understand correctly?
You still have the buffer (the class has to go somewhere!), but
it is implicit (you can't refer to it directly only through the
class reference) and so is the destructor call, as opposed to the
emplace + explicit buffer combo. In the latter case the class
destructor will not be called automatically so you must do it
yourself with `destroy`.