Legacy Issue Number: 18210
Source: dpdx.net ( Brooks Moses)
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.)
Reported: VSIPL++ 1.2 — Tue, 23 Oct 2012 04:00 GMT
Updated: Fri, 6 Mar 2015 20:57 GMT