We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如题,机制类似:
struct Guard { ContainerType* p_container_; ~Guard() { if (p_container_) p_container_->rollback_operation(); } };
在需要异常回滚的代码之前创建一个 Guard 对象:
Guard
Guard guard_{this};
在操作成功后将防护废弃掉:
guard_.p_container_ = nullptr;
The text was updated successfully, but these errors were encountered:
大佬,我都看不懂。。
Sorry, something went wrong.
No branches or pull requests
如题,机制类似:
在需要异常回滚的代码之前创建一个
Guard
对象:Guard guard_{this};
在操作成功后将防护废弃掉:
guard_.p_container_ = nullptr;
The text was updated successfully, but these errors were encountered: