class AutoSomething
{
public:
AutoSomething(Object& ob)
: object_(object)
{}
~AutoSomething()
{
object_.some_callback();
}
private:
Object& object_;
};
.........
void Object::some_function()
{
AutoSomething some(*this);
some_function_which_may_throw_exception();
}
问题是 - 当 AutoSomething 的析构函数被调用时,Object 的状态会好吗?