Issue 18210: 'Explicit copy' function to clarify view copy semantics (vsiplxx-rtf) Source: (Mr. Brooks Moses, brooks.moses(at)dpdx.net) Nature: Enhancement Severity: Minor Summary: The rules for when a copy constructor "View v(w);" will create a view v that aliases the view w are somewhat esoteric and likely to lead to confusion -- the result depends on details of the type of w, which do not appear on this line and (with templates) may be in an entirely separate section of the code. It would be handy to have versions of this statement which are predictable with regards to copy or alias, and which make the intent explicit. Unfortunately this is not possible with the alias case, but we can at least resolve it for the copy case. Thus, I propose we add a deep_copy() function (or a method on views) which would allow us to write "View v(deep_copy(w));" -- with the result that v has the same size as w, and the same values, but is guaranteed to be a copy rather than an alias. (Note that the "deep_copy" name is just a stand-in; there may be better names for this functionality.) Resolution: In the interest of closing the current RTF so that the solutions to resolved issues can be made publically available, this issue is deferred to the next RTF. Disposition: Deferred Revised Text: Actions taken: October 23, 2012: received issue Discussion: End of Annotations:===== te: Tue, 23 Oct 2012 11:51:29 -0700 From: Brooks Moses User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 To: Subject: VSIPL++ issue (#14 from me) X-OriginalArrivalTime: 23 Oct 2012 18:51:30.0130 (UTC) FILETIME=[69ED3B20:01CDB14F] Name: Brooks Moses Employer: Mentor Graphics mailFrom: brooks_moses@mentor.com Terms_Agreement: I agree Specification: VSIPL++ Section: 8 [view] FormalNumber: ptc/2012-07-27 Version: 1.2 - FTF Beta 1 Doc_Year: 2012 Doc_Month: August Doc_Day: 10 Page: 47- Title: 'Explicit copy' function to clarify view copy semantics Nature: Enhancement Severity: Minor B1: Report Issue Description: The rules for when a copy constructor "View v(w);" will create a view v that aliases the view w are somewhat esoteric and likely to lead to confusion -- the result depends on details of the type of w, which do not appear on this line and (with templates) may be in an entirely separate section of the code. It would be handy to have versions of this statement which are predictable with regards to copy or alias, and which make the intent explicit. Unfortunately this is not possible with the alias case, but we can at least resolve it for the copy case. Thus, I propose we add a deep_copy() function (or a method on views) which would allow us to write "View v(deep_copy(w));" -- with the result that v has the same size as w, and the same values, but is guaranteed to be a copy rather than an alias. (Note that the "deep_copy" name is just a stand-in; there may be better names for this functionality.) - Brooks