Article View: comp.lang.c++
Article #1019Re: A better experimental::scope_exit
From: Bonita Montero
Date: Tue, 24 Nov 2026 06:12
Date: Tue, 24 Nov 2026 06:12
25 lines
2683 bytes
2683 bytes
Am 24.11.2026 um 01:12 schrieb Tristan Wibberley: > The facility is here eliciting the feeling that, by using it, one may > disregard the possibility that exceptions pass out of it's members and > destructor or that exceptions passing out of the callbacks I provide to > it are unable to affect its behaviours that I intuitively expect. > However, only Fn is tested for being nothrow invocable. There are also > ::run and ::disable of the dependency node to consider. My template trickery checks if the dependent node is a defer<>; so it's also checked if it's fn is also noexcept. > There is much to talk about on interface design so this would be > longwinded and annoying if I did. I wonder if it's better to work with > client callbacks that throw exceptions so the surprises of the limited > compose-ability are removed. I suppose it depends on the scale of the > development that the class is being used in. I thought about that for a while and I came to the conclusion that this scope guard isn't different from a normal destructor, which is noexcept by default; so I did it the same way to enforce Fn to be noexcept. > Does C++ still allow noexcept(false) destructors and does an exception > at the end of a destructor allow the members to be destroyed? ... Yes, you can do that; but I guess that's very uncommon.
Technical Details
Message-ID:
<11e39t7$2ia0c$1@raubtier-asyl.eternal-september.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mailReferences:
<11dsk17$8ske$2@raubtier-asyl.eternal-september.org> <11e2kpl$2cc7p$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail From: Bonita Montero <Bonita.Montero@gmail.com> Newsgroups: comp.lang.c++ Subject: Re: A better experimental::scope_exit Date: Tue, 24 Nov 2026 07:12:56 +0100 Organization: A noiseless patient Spider Lines: 25 Message-ID: <11e39t7$2ia0c$1@raubtier-asyl.eternal-september.org> References: <11dsk17$8ske$2@raubtier-asyl.eternal-september.org> <11e2kpl$2cc7p$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 24 Nov 2026 06:12:56 +0000 (UTC) Injection-Info: raubtier-asyl.eternal-september.org; logging-data="2697228"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Ci/4s0+rZrn9N/Zijzsdf785Nd7uA4Eo="; posting-host="ca1abd9352a386a60f2eda7d3d1dd128" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:UPie/hbqXUKjKiUJvQRHiT7wfA0= sha256:nHJAM35T8vjdvtANwOdZUJOZsT4ylv1SuLBEn0otZZQ= sha1:BBuYSYzyeQdaQPZ+9Sd36FntWEg= sha256:XZSLDTxAFuzHY+WQdT5Nzos7qgq6rE7eDqJzow0Zh/A= Content-Language: de-DE In-Reply-To: <11e2kpl$2cc7p$1@dont-email.me>