
On 4/14/23 09:39, Andrzej Krzemienski wrote:
niedz., 9 kwi 2023 o 03:11 Andrey Semashev via Boost
mailto:boost@lists.boost.org> napisał(a): Yes, you can manually (de)activate the guard in small and contained cases, but in general I would very much prefer it to work automatically. Otherwise, it quickly becomes a maintenance nightmare that it was supposed to fix.
True. Therefore in my code I would contain the code that requires a guard. (In general, I prefer RAII.) But even contained cases need a scope guard.
So, the trade-off is this: scope_fail: - requires no manual deactivate
scope_guard with deactivate(): - works uniformly and unsurprisingly in all contexts, including coroutines - is fast.
I would recommend that this trade-off is documented.
Yes, that makes sense. I will update the docs.