C++ Logo

std-proposals

Advanced search

Re: [std-proposals] int Func(void) noreentry(-1)

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Thu, 16 Feb 2023 19:08:06 -0600
On Thu, 16 Feb 2023, 17:08 Frederick Virchanza Gotham via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> On Thu, Feb 16, 2023 at 10:31 PM Thiago Macieira wrote:
> >
> > > `foo` is now *moveable*, whereas before (since it stored a `mutex`),
> > > it was not moveable. If I use a `shared_ptr`, it could be copyable
> > > too.
> >
> > Bonus: it allows controlling reentrancy on a set of objects of this class
> > larger than 1 and less than the universe.
>
>
> If you want to retain movability, the syntax is:
>
> void Func(void) noreentry&&;
>

And how do you specify which allocator to use for the stable per instance
state?

Come to think of it, what happens if that function is invoked on a moved
from object?

Those two ampersands are not to be confused with marking a method to
> only be invoked on an R-value, which would be:
>
> void Func(void) && noreentry&&;
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2023-02-17 01:08:19