|
Boost : |
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2023-03-22 09:38:12
On Wed, Mar 22, 2023 at 10:04â¯AM Andrey Semashev via Boost <
boost_at_[hidden]> wrote:
> error_code ec;
> scope_fail guard(
> [&] { std::cout << "Failure" << std::endl; },
> [&ec] { return !!ec; });
>
Having made the dumb mistake of writing once or twice `scope_fail(...);`
instead of `scope_fail guard(...);`, is there a way to prevent that?
Like [[nodiscard]] with an alternate form like `auto guard =
scope_fail(...);` ?
I guess that requires move'ability, which might not be desirable?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk