C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::contains_mutable

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Sat, 1 Jul 2023 23:47:34 +0100
On Sat, Jul 1, 2023 at 11:33 PM Frederick Virchanza Gotham
<cauldwell.thomas_at_[hidden]> wrote:
> I would have a synchronisation
> issue on the non-atomic boolean if it were to be edited when a
> shared_mutex is locked in shared mode.


Actually this is why there should be two new additions to <type_traits>:

    std::contains_mutable
    std::contains_nonatomic_mutable

The former will be true for any class that has a mutable member. The
latter will be true for any class that has a mutable member but only
if the mutable member is non-atomic.

Received on 2023-07-01 22:47:45