Is a C++ destructor guaranteed not to be called until the end of the block?

后端 未结 8 1977
孤街浪徒
孤街浪徒 2021-01-03 18:03

In the C++ code below, am I guaranteed that the ~obj() destructor will be called after the // More code executes? Or is the compiler allowed to destruct the

8条回答
  •  太阳男子
    2021-01-03 18:42

    The destructor will not be called until the object goes out of scope.

    The C++ faq lite has a good section on dtors

提交回复
热议问题