22 Mar
2023
22 Mar
'23
9:38 a.m.
On Wed, Mar 22, 2023 at 10:04 AM Andrey Semashev via Boost < boost@lists.boost.org> 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?