C++ Logo

std-proposals

Advanced search

Re: Allowing access to object representations

From: sdkrystian <sdkrystian_at_[hidden]>
Date: Mon, 19 Aug 2019 19:26:13 -0400
I remember talking to k-ballo about this a while ago, and he asked Richard Smith, and yes, the lifetime of the elements ends, but the array doesn't.> I think it's impossible to say that the lifetime of an array does not end while the lifetimes of its elements end.How would it be impossible? We can already do this:``` struct S {};S a[5];a[0].~S(); // element lifetime ended, but array is ok```Sent from my Samsung Galaxy smartphone.
-------- Original message --------From: "language.lawyer--- via Std-Proposals" <std-proposals_at_[hidden]> Date: 8/19/19 18:48 (GMT-05:00) To: std-proposals_at_[hidden] Cc: language.lawyer_at_[hidden] Subject: Re: [std-proposals] Allowing access to object representations On 20/08/2019 01:23, Brian Bi wrote:> Sorry, my fault for not understanding what you wrote previously. But are> you sure this interpretation is sensible?If you need an authority, AFAIR you may find R. Smith explaining this in the old std-discussion list.But IMO this is clear enough, at least after you've learned it ;)> I think it's impossible to say> that the lifetime of an array does not end while the lifetimes of its> elements end.Why???The Standard seem to know about objects whose subobjects may not be alive, like in [intro.object]/2:> If an object is created in storage associated with a member subobject or array element e (which may or may not be within its lifetime)It is even possible, for some types (not array types, though), to end the lifetime of a containing object without ending the lifetimes of all (or even any!) of its subobjects...>> (I'd say it always was undefined)>>> > CWG thought it was well-defined in 2011.Fortunately, they realized quickly enough that they were wrong and did not close a similar issue in 2013.-- Std-Proposals mailing listStd-Proposals_at_[hidden]://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2019-08-19 18:28:18