我的代码需要范围保护,但是我是否必须Dismiss()
在正常退出函数时手动所有范围保护?IE
void Deleter(MyClass* obj)
{
delete obj;
}
MyClass* Func()
{
MyClass* obj = new MyClass();
ScopeGuard sg1 = MakeObjGuard(Deleter, obj);
//More objects created. And more scope guards.
sg1.Dismiss();
//...Same for other guards
return obj;
}