Subject: Re: On "transparently replaceable" in std::vector operations
Date: 2021-06-23 05:55:22
On 23/06/2021 12:49, LÃ©nÃ¡rd Szolnoki via Std-Discussion wrote:
> In my reading the pointer value itself can become invalid, the pointer doesn't need to change value.
I don't understand what does Â«value itself can become invalidÂ» mean.
> The value of a trivially copyable type is determined from its value representation.
This is not correct. And it is easy to show counterexamples, especially with pointer values.
> The value representation can only change when the object is accessed.
If assume that accessing a value representation means accessing the object, this claim becomes trivial/tautological/irrefutable. (If a program reads the value representation twice and discovers that it has changed, this is because it accessed the object and thus changed its value representation).
> But a pointer can become invalid without accessing it, therefore it's the value itself that has to become invalid in that case.
The conclusion may follow from the premise, however, the premise feels like your postulate.
STD-DISCUSSION list run by email@example.com
Older Archives on Google Groups