C++ Logo

std-proposals

Advanced search

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

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 16 Feb 2023 23:08:07 +0000
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&&;

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&&;

Received on 2023-02-16 23:08:20