C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Execute statement when leaving scope

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Mon, 12 Dec 2022 13:26:00 -0500
On Mon, Dec 12, 2022 at 1:11 PM Jason C via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> It is unclear to me what these proposals (both this new one and the `scope_*` proposals) add that is not already trivially possible with code in scoped object destructors.

What does `std:unique_ptr` add is not "already trivially possible"? It
adds vocabulary, so that everyone can easily see and digest what your
intent is.

Why does everyone need to roll their own "generic_cleanup" class when
there could be a simple standard-defined one? And yours is horribly
inefficient, as it uses `std::function`.

Received on 2022-12-12 18:27:51