Article View: comp.lang.c++
Article #1011Re: A better experimental::scope_exit
From: boltar
Date: Mon, 23 Nov 2026 16:46
Date: Mon, 23 Nov 2026 16:46
29 lines
2089 bytes
2089 bytes
On Mon, 23 Nov 2026 16:37:32 GMT
scott@slp53.sl.home (Scott Lurndal) gabbled:
>Bonita Montero <Bonita.Montero@gmail.com> writes:
>>Am 23.11.2026 um 13:26 schrieb David Brown:
>>
>>> template<typename T>
>>> struct scope_exit {
>>> T f;
>>> scope_exit(T f) : f(f) { }
>>> ~scope_exit() { f(); }
>>> };
>>
>>You can't cascade multiple exits with that. This means if you have
>>several manipulations on a data structure and you want to revert them
>>if an exception occurs the destructor revers the changes so far. But
>>if nothing happens in that sense you simply call .disable() on the
>>last node in the chain and all dependent nodes are also disabled.
>>Just as a commit in a databse.
>
>KISS. This is from a 1992-ish port of Unix to run as
>an actor for the Chorus microkernel.
>
>//
>// Destructor: undo what fork has done upon failure.
>//
>tForkFailure::~tForkFailure()
Why is fork failure a specific class? Thats a bit wierd.
Technical Details
Message-ID:
<11e1qla$227b2$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11dsk17$8ske$2@raubtier-asyl.eternal-september.org> <11e1bd7$1rqma$1@dont-email.me> <11e1gtl$1u1jq$1@raubtier-asyl.eternal-september.org> <gZZMS.79729$Mef7.47357@fx15.iad>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!.POSTED!not-for-mail From: boltar@caprica.universe Newsgroups: comp.lang.c++ Subject: Re: A better experimental::scope_exit Date: Mon, 23 Nov 2026 16:46:34 -0000 (UTC) Organization: A noiseless patient Spider Lines: 29 Message-ID: <11e1qla$227b2$1@dont-email.me> References: <11dsk17$8ske$2@raubtier-asyl.eternal-september.org> <11e1bd7$1rqma$1@dont-email.me> <11e1gtl$1u1jq$1@raubtier-asyl.eternal-september.org> <gZZMS.79729$Mef7.47357@fx15.iad> Injection-Date: Mon, 23 Nov 2026 16:46:34 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2170210"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Ruo+/Xzj/Cv8jlOA6OkT0"; posting-host="9c243761ac1b7a91cd7dd467964364b3" Cancel-Lock: sha1:3F90ez88lTJvxUyZDiLmBxhHz1A= sha256:+/U2F/xo0gCtVcfw/1BFVfq4C0EVA6g6v+K6FlruTsU= sha1:AC32NDCE3GGTlOIMOfMdGSbRpOw= sha256:5GTbQoNp2pVsTqE9Ba9CNMmgXIxVwtQKPsj9r6dmnOI=