C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Alteration of elements in a set (non-const iterator)

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Mon, 22 May 2023 14:05:34 -0500
On Mon, 22 May 2023 at 13:55, Thiago Macieira <thiago_at_[hidden]> wrote:

> On Monday, 22 May 2023 11:18:45 PDT Edward Catmur wrote:
> > I've been meaning to ask for a [[really_const]] attribute for a while.
> >
> > It shouldn't be necessary (per the standard, implementations might want
> to
> > add it anyway).
>
> That's for the first case I pasted, where the sub-object isn't a const
> object,
> but we called a const member function. It is allowed to const_cast and
> modify
> the object, because the object isn't const.
>
> I want an attribute to say "no, really, I promise not to const_cast".
>

Oh, like [[gnu::pure]]? https://gcc.godbolt.org/z/6MevY4aej

Received on 2023-05-22 19:05:47