C++ Logo


Advanced search

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

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Mon, 22 May 2023 12:27:21 +0100
On Mon, 22 May 2023 at 11:53, Oleksandr Koval via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> That pair holds the "first" data member with type const T1. That's very
>> much a const object.
> Hm, I thought that because it's inside a struct, it's actually a
> "subobject", not an "object".

Yes, that's how I understand it too.

> I always understood const_cast rule in a way that you can change
> const-ness as long as the underlying memory is not a read-only and I don't
> understand how it's possible to have a struct which has some members of it
> in a read-only memory and others in a read-write one.

https://cplusplus.github.io/CWG/issues/2514.html is related to this point.

Received on 2023-05-22 11:27:35