C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Relocation in C++

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Fri, 23 Dec 2022 08:19:11 +0100
On Thu, 22 Dec 2022 at 23:40, Magnus Fromreide <magfr_at_[hidden]> wrote:

> On Thu, Dec 22, 2022 at 07:02:34PM +0100, Edward Catmur via Std-Proposals
> wrote:
> >
> > Yes, such as `reloc guard, f();` - note the comma. I think here `f()`
> > should be protected by the guard.
>
> I think that would be unexpected, please remember that the comma in a
> comma expression is a sequence point.
>

We don't use that terminology any more:
http://eel.is/c++draft/intro.execution#def:sequenced_before

But sequencing has no impact on destruction of temporaries. This code is
analogous to the short-hand (idiomatic in some areas) where a lock is taken
out on a mutex to protect a call and released at the end of the
full-expression:

std::unique_lock(mutex), f();

Received on 2022-12-23 07:19:22