220 36717 <4fa792ec-1f51-4357-a65a-2ce3c10c60c0@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: mihailnajdenov@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Static analysis and the future of C++
Date: Sat, 20 Jan 2018 03:12:09 -0800 (PST)
Lines: 730
Approved: news@gmane.org
Message-ID: <4fa792ec-1f51-4357-a65a-2ce3c10c60c0@isocpp.org>
References: <0087c1a4-0b36-40ca-8d43-5bfaf0af62ca@isocpp.org>
 <a395ffbf-fc53-4288-b1ca-f559e1703eac@isocpp.org>
 <88864914-82a8-4a8b-bda7-cffd38379edf@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1839_156315941.1516446729100"
X-Trace: blaine.gmane.org 1516446625 24938 195.159.176.226 (20 Jan 2018 11:10:25 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 20 Jan 2018 11:10:25 +0000 (UTC)
Cc: mihailnajdenov@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCUJ3A7GRAPRBCWIRTJQKGQE43PPNHQ@isocpp.org Sat Jan 20 12:10:20 2018
Return-path: <std-proposals+bncBCUJ3A7GRAPRBCWIRTJQKGQE43PPNHQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f71.google.com ([209.85.213.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUJ3A7GRAPRBCWIRTJQKGQE43PPNHQ@isocpp.org>)
	id 1ecr2F-0005SW-HW
	for gclcip-std-proposals@m.gmane.org; Sat, 20 Jan 2018 12:10:07 +0100
Original-Received: by mail-vk0-f71.google.com with SMTP id o13sf2392665vkc.22
        for <gclcip-std-proposals@m.gmane.org>; Sat, 20 Jan 2018 03:12:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=8GK81bJXX+jNk8xkFyJspJkplgOPodNrHkdZGICte14=;
        b=Lkg/OHiZEkPDWDzdAd1yHXVbxhmuqXfIm3Tj3qH7ezcA1nvyZ4en0f640vcDPEEnVD
         x3G0o4Zh8D8IhIX5NM3lCx/YFqUyo5JUHUeU4uoVtzQmlOCP7MyODK3AOBUsRZ+W5BTa
         YDPcfTfwGjFRZrk8jcU1kRgZ+3nAcmE8Fkkk6LkVRYkV2JJ8aXVuzdz+TPpervfc4G9Y
         cOidQtMdwBqvtPAHiekihivkCVAdb2g4ATQpLz5LeBuh/m6T7CGgXPWCGOJ3DYdNg50s
         NAoTixyPMAMp28PuxgMwHFrm6fvPLYkAjmoXX7arUqN34/QPQKk00iTPqnv5FqwG/cD4
         g0LA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=8GK81bJXX+jNk8xkFyJspJkplgOPodNrHkdZGICte14=;
        b=bs5GdS5+Iyy/2XGplHiKiB5XbX2Cp0WkW3zF7aRJr6FC/Qzg0QzAR8f3lOdeihvkIY
         3bpbs0WsiIgBfAuMwOUUxjiZ+If2Xl5qoFyZLHWWzHvsTv2v/uOMJJ2HZygOBAXaPIf+
         pHtXQQCwv4zyYWNoMKxVoWqyLpzXDF+NTLD/aiRWPUizkbAaPNFstCQWLCxTvzJ4kaEz
         0SuV8P0L4Y5BvIErjNw7MvYuLFu+1PraPzIE4nua5yIxqF4gBt+VSS9s1n/od/XmfrHd
         0BrGwHvUJeaUgt+E9ddEYySlPZ9Z8LutUywL9Z/xK/X5DJrgJcnh285gboYQnf+eNTGq
         vZfA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=8GK81bJXX+jNk8xkFyJspJkplgOPodNrHkdZGICte14=;
        b=Yc0ykSR4C7za90EHEFbrDuG74AXW+GNH0/sy9IK4w2IzeIJNJJRzF/IZLkTxH09C1q
         1iLrZzbaxRmgGWgGLYFQm2O5kxNb2NMQmtPxyl7RM2Mu8jDdFNdzd8QKqvBuy9JHRQ0w
         ucLy99XsLYzfCzBfJoBoPAAW7S/ckM3W8YBdsVQgLWYeBFbIK+cRL4PJysKKVVSr9e3n
         fRbwspdkf8mdr99Kj/bxGVscb38etf40hPIJYBMnGqEJcdJM+p6Xy6x8H9wrGewXFSSG
         3OXQTNknIOdq75uG/f/iOKLkpmljGAFybSjiJ1XiZWQZBa3LKxkYCfwE2ZhuNnmLeSVa
         jweg==
X-Gm-Message-State: AKwxytcuXfC9yhXwhej5cRLMgeTMecBM54NSBobEiGdPVX7TWKNxR+vf
	B6OKYU7OLTm+Ev5sKr/LPMtJtw==
X-Google-Smtp-Source: AH8x225nGX1mfRJnF+s91c+YgLHFJ5KR5ROzG2YpCWJPvTNwnpNCRysnJYtz7nPqoskfNk5/Ps+HWQ==
X-Received: by 10.176.71.211 with SMTP id w19mr688248uac.111.1516446731435;
        Sat, 20 Jan 2018 03:12:11 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.174.150 with SMTP id x144ls972822vke.2.gmail; Sat, 20 Jan
 2018 03:12:10 -0800 (PST)
X-Received: by 10.31.168.202 with SMTP id r193mr149936vke.4.1516446729747;
        Sat, 20 Jan 2018 03:12:09 -0800 (PST)
In-Reply-To: <88864914-82a8-4a8b-bda7-cffd38379edf@isocpp.org>
X-Original-Sender: MihailNajdenov@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:36717
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36717>

------=_Part_1839_156315941.1516446729100
Content-Type: multipart/alternative; 
	boundary="----=_Part_1840_749971179.1516446729101"

------=_Part_1840_749971179.1516446729101
Content-Type: text/plain; charset="UTF-8"



On Friday, January 19, 2018 at 10:19:40 PM UTC+2, Nicol Bolas wrote:
>
> On Friday, January 19, 2018 at 7:30:52 AM UTC-5, mihailn...@gmail.com 
> wrote:
>>
>> Can we "just" define special behavior of observer_ptr (in debug/analyze 
>> mode) and solve all cases of lifetime monitoring (under the said 
>> limitations) - from smart pointers to function_view?
>>
>
> That's not "behavior" of the type. There is no actual code in 
> `observer_ptr` that does anything you're talking about. It's simply a 
> compiler or tool that sees you using this particular type and starts 
> looking at things because of it.
>

If the constructor and reset of observer_ptr are decorated with something 
like [[debug:observe_destruction]] the behavior of observer_ptr will be 
enforced by the compiler. 

The behavior, use and definition of observer_ptr are not changed.  
 

>
> It should also be noted that this still doesn't handle perfect forwarding. 
> Not unless it is the caller of the function who wraps the parameter in an 
> `observer_ptr`.
>

class A_view
{
  A_view(const A* pa) : _p(pa) {}
  A_view(const A& a) : _p(&a) {}
  A_view(A&& a) : _p(&a) {}

  observer_ptr<const A> _p;
}; 

observer_ptr will monitor addressof(*_p) for ~A() call. The scope of 
monitoring is ~observer_ptr() or release() call.

Copies of observer_ptr still monitor the same address, but with a different 
scope - their dtor, release or reset.


That is a major difference from lifetime extension - we can have 
many-to-one mapping without any semantic or implementation problems. Lifetime 
extension does not allow copies of a view/ref to extend with the lifetime 
of the object.
We are also not limited to initialization only - the monitoring can 
(re)start at the call of reset() instead on constructor call only. Lifetime 
extension deals with initialization exclusively. 


How can perfect forwarding interfere in all this? 


template<typename T, typename ...Args>
auto init(Args&&... arg)
{
  return T(std::forward<Args>(arg)...); //< observer_ptr starts monitoring 
&arg
}

int main()
{ 
  auto v = init<A_view>(A{}); //< both A_view and A allocated. A_view 
usable before the ';' when ~A is called
}

If copy elision does not kick-in nothing changes - copy is safe and 
defined, lifetime of A is the same.

If we pass arguments and create A in init() instead ( return  T(A(std::forward<Args>(arg)...)); 
), then the observer_ptr is still created with a valid address, 
however, after we return will not be able to use A_view in any way, 
including before the ';'. 

If both there is no elision and A is created when initializing T inside 
init, then the returned view can be created from a dangling view. 
We could allow views from dangling views to be created, however no dtor 
will be monitored and all uses of the view will be illegal until 
destroyed/reset/release-ed. 
We could also issue a warning on coping from dangling view without problem.




 

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/4fa792ec-1f51-4357-a65a-2ce3c10c60c0%40isocpp.org.

------=_Part_1840_749971179.1516446729101
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Friday, January 19, 2018 at 10:19:40 PM UTC+2, =
Nicol Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr">On Friday, January 19, 2018 at 7:30:52 AM UTC-5, <a>mihailn...@gmail.c=
om</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-lef=
t:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>=
<font face=3D"arial,sans-serif"><span style=3D"text-align:left;color:rgb(34=
,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-size=
:13px;font-style:normal;font-variant:normal;font-weight:400;text-decoration=
:none;word-spacing:0px;display:inline!important;white-space:normal;float:no=
ne;background-color:transparent">Can we <span style=3D"display:inline!impor=
tant;float:none;background-color:transparent;color:rgb(34,34,34);font-famil=
y:arial,sans-serif;font-size:13px;font-style:normal;font-variant:normal;fon=
t-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;tex=
t-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">&quot=
;just&quot; </span>define special behavior of=C2=A0<span style=3D"backgroun=
d-color:transparent;border-bottom-color:rgb(34,34,34);border-bottom-style:n=
one;border-bottom-width:0px;border-left-color:rgb(34,34,34);border-left-sty=
le:none;border-left-width:0px;border-right-color:rgb(34,34,34);border-right=
-style:none;border-right-width:0px;border-top-color:rgb(34,34,34);border-to=
p-style:none;border-top-width:0px;color:rgb(34,34,34);display:inline;float:=
none;font-family:arial,sans-serif;font-size:13px;font-style:normal;font-var=
iant:normal;font-weight:400;letter-spacing:normal;margin-bottom:0px;margin-=
left:0px;margin-right:0px;margin-top:0px;padding-bottom:0px;padding-left:0p=
x;padding-right:0px;padding-top:0px;text-align:left;text-decoration:none;te=
xt-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">obse=
rver_ptr (in debug/analyze mode) and solve all cases of lifetime monitoring=
 (under the said limitations) - from smart pointers to function_view?</span=
></span></font></div></div></blockquote><div><br></div><div>That&#39;s not =
&quot;behavior&quot; of the type. There is no actual code in `observer_ptr`=
 that does anything you&#39;re talking about. It&#39;s simply a compiler or=
 tool that sees you using this particular type and starts looking at things=
 because of it.</div></div></blockquote><div><br></div><div>If the construc=
tor and reset of <span style=3D"display: inline !important; float: none; ba=
ckground-color: transparent; color: rgb(34, 34, 34); font-family: &quot;Ari=
al&quot;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; font-style: nor=
mal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphan=
s: 2; text-align: left; text-decoration: none; text-indent: 0px; text-trans=
form: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spaci=
ng: 0px;">observer_ptr are decorated with something like<font face=3D"couri=
er new,monospace"> [[debug:observe_destruction]] </font>the=C2=A0<span styl=
e=3D"display: inline !important; float: none; background-color: transparent=
; color: rgb(34, 34, 34); font-family: &quot;Arial&quot;,&quot;Helvetica&qu=
ot;,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; =
font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; tex=
t-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-st=
roke-width: 0px; white-space: normal; word-spacing: 0px;">behavior of=C2=A0=
<span style=3D"background-color: transparent; border-bottom-color: rgb(34, =
34, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-=
outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-i=
mage-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34=
); border-left-style: none; border-left-width: 0px; border-right-color: rgb=
(34, 34, 34); border-right-style: none; border-right-width: 0px; border-top=
-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; col=
or: rgb(34, 34, 34); display: inline; float: none; font-family: &amp;quot;A=
rial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif; font-size: 13px; f=
ont-style: normal; font-variant: normal; font-weight: 400; letter-spacing: =
normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top=
: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0=
px; padding-top: 0px; text-align: left; text-decoration: none; text-indent:=
 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: no=
rmal; word-spacing: 0px;">observer_ptr will be enforced by the compiler. </=
span></span></span></div><div><span style=3D"display: inline !important; fl=
oat: none; background-color: transparent; color: rgb(34, 34, 34); font-fami=
ly: &quot;Arial&quot;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; fo=
nt-style: normal; font-variant: normal; font-weight: 400; letter-spacing: n=
ormal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0p=
x; text-transform: none; -webkit-text-stroke-width: 0px; white-space: norma=
l; word-spacing: 0px;"><span style=3D"display: inline !important; float: no=
ne; background-color: transparent; color: rgb(34, 34, 34); font-family: &qu=
ot;Arial&quot;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; font-styl=
e: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text=
-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word=
-spacing: 0px;"><span style=3D"background-color: transparent; border-bottom=
-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0p=
x; border-image-outset: 0; border-image-repeat: stretch; border-image-slice=
: 100%; border-image-source: none; border-image-width: 1; border-left-color=
: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; border-=
right-color: rgb(34, 34, 34); border-right-style: none; border-right-width:=
 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border-top=
-width: 0px; color: rgb(34, 34, 34); display: inline; float: none; font-fam=
ily: &amp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif; fo=
nt-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; =
letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right:=
 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; =
padding-right: 0px; padding-top: 0px; text-align: left; text-decoration: no=
ne; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px;=
 white-space: normal; word-spacing: 0px;"><br></span></span></span></div><d=
iv><span style=3D"display: inline !important; float: none; background-color=
: transparent; color: rgb(34, 34, 34); font-family: &quot;Arial&quot;,&quot=
;Helvetica&quot;,sans-serif; font-size: 13px; font-style: normal; font-vari=
ant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-ali=
gn: left; text-decoration: none; text-indent: 0px; text-transform: none; -w=
ebkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><spa=
n style=3D"display: inline !important; float: none; background-color: trans=
parent; color: rgb(34, 34, 34); font-family: &quot;Arial&quot;,&quot;Helvet=
ica&quot;,sans-serif; font-size: 13px; font-style: normal; font-variant: no=
rmal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: lef=
t; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-t=
ext-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><span style=
=3D"background-color: transparent; border-bottom-color: rgb(34, 34, 34); bo=
rder-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; =
border-image-repeat: stretch; border-image-slice: 100%; border-image-source=
: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-l=
eft-style: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34=
); border-right-style: none; border-right-width: 0px; border-top-color: rgb=
(34, 34, 34); border-top-style: none; border-top-width: 0px; color: rgb(34,=
 34, 34); display: inline; float: none; font-family: &amp;quot;Arial&amp;qu=
ot;,&amp;quot;Helvetica&amp;quot;,sans-serif; font-size: 13px; font-style: =
normal; font-variant: normal; font-weight: 400; letter-spacing: normal; mar=
gin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orph=
ans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding=
-top: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-=
transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-=
spacing: 0px;">The behavior, use and definition of observer_ptr are not cha=
nged. =C2=A0</span></span></span></div><div>=C2=A0</div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"ltr"><div><br></div><div>It should =
also be noted that this still doesn&#39;t handle perfect forwarding. Not un=
less it is the caller of the function who wraps the parameter in an `observ=
er_ptr`.</div></div></blockquote><div><br></div><div><font face=3D"courier =
new,monospace">class A_view</font></div><div><font face=3D"courier new,mono=
space">{</font></div><div><font face=3D"courier new,monospace">=C2=A0 </fon=
t><font face=3D"courier new,monospace"><span style=3D"text-align: left; col=
or: rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter-spacing=
: normal; font-size: 13px; font-style: normal; font-variant: normal; font-w=
eight: 400; text-decoration: none; word-spacing: 0px; display: inline !impo=
rtant; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-wi=
dth: 0px; background-color: transparent;">A_view(const A* pa) : _p(pa) {}</=
span></font></div><div><font face=3D"courier new,monospace">=C2=A0 <span st=
yle=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; text=
-indent: 0px; letter-spacing: normal; font-size: 13px; font-style: normal; =
font-variant: normal; font-weight: 400; text-decoration: none; word-spacing=
: 0px; display: inline !important; white-space: normal; orphans: 2; float: =
none; -webkit-text-stroke-width: 0px; background-color: transparent;"><span=
 style=3D"background-color: transparent; border-bottom-color: rgb(34, 34, 3=
4); border-bottom-style: none; border-bottom-width: 0px; border-image-outse=
t: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-=
source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); bo=
rder-left-style: none; border-left-width: 0px; border-right-color: rgb(34, =
34, 34); border-right-style: none; border-right-width: 0px; border-top-colo=
r: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color: r=
gb(34, 34, 34); display: inline; float: none; font-family: &amp;quot;Arial&=
amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif; font-size: 13px; font-s=
tyle: normal; font-variant: normal; font-weight: 400; letter-spacing: norma=
l; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px=
; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; p=
adding-top: 0px; text-align: left; text-decoration: none; text-indent: 0px;=
 text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal;=
 word-spacing: 0px;">A_view(const A&amp; a) : _p(&amp;a) {}</span></span></=
font></div><div><font face=3D"courier new,monospace">=C2=A0 <span style=3D"=
text-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent=
: 0px; letter-spacing: normal; font-size: 13px; font-variant: normal; word-=
spacing: 0px; display: inline !important; white-space: normal; orphans: 2; =
float: none; -webkit-text-stroke-width: 0px; background-color: transparent;=
"><span style=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); bo=
rder-image: none; text-align: left; color: rgb(34, 34, 34); text-transform:=
 none; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-vari=
ant: normal; word-spacing: 0px; display: inline; white-space: normal; orpha=
ns: 2; float: none; -webkit-text-stroke-width: 0px; background-color: trans=
parent;"><span style=3D"background-color: transparent; border-bottom-color:=
 rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; bord=
er-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%;=
 border-image-source: none; border-image-width: 1; border-left-color: rgb(3=
4, 34, 34); border-left-style: none; border-left-width: 0px; border-right-c=
olor: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; b=
order-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width:=
 0px; color: rgb(34, 34, 34); display: inline; float: none; font-family: &a=
mp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif; font-size=
: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-=
spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; m=
argin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding=
-right: 0px; padding-top: 0px; text-align: left; text-decoration: none; tex=
t-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-=
space: normal; word-spacing: 0px;">A_view(A&amp;&amp; a) : _p(&amp;a) {}</s=
pan></span></span></font></div><div><span style=3D"text-align: left; color:=
 rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter-spacing: n=
ormal; font-size: 13px; font-variant: normal; word-spacing: 0px; display: i=
nline !important; white-space: normal; orphans: 2; float: none; -webkit-tex=
t-stroke-width: 0px; background-color: transparent;"><span style=3D"margin:=
 0px; padding: 0px; border: 0px rgb(34, 34, 34); border-image: none; text-a=
lign: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px;=
 letter-spacing: normal; font-size: 13px; font-variant: normal; word-spacin=
g: 0px; display: inline; white-space: normal; orphans: 2; float: none; -web=
kit-text-stroke-width: 0px; background-color: transparent;"><span style=3D"=
background-color: transparent; border-bottom-color: rgb(34, 34, 34); border=
-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; bord=
er-image-repeat: stretch; border-image-slice: 100%; border-image-source: no=
ne; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-=
style: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); b=
order-right-style: none; border-right-width: 0px; border-top-color: rgb(34,=
 34, 34); border-top-style: none; border-top-width: 0px; color: rgb(34, 34,=
 34); display: inline; float: none; font-family: &amp;quot;Arial&amp;quot;,=
&amp;quot;Helvetica&amp;quot;,sans-serif; font-size: 13px; font-style: norm=
al; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-=
bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans:=
 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top=
: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-tran=
sform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spac=
ing: 0px;"><font face=3D"courier new,monospace"><br></font></span></span></=
span></div><div><font face=3D"courier new,monospace">=C2=A0 <span style=3D"=
text-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent=
: 0px; letter-spacing: normal; font-size: 13px; font-variant: normal; word-=
spacing: 0px; display: inline !important; white-space: normal; orphans: 2; =
float: none; -webkit-text-stroke-width: 0px; background-color: transparent;=
"><span style=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); bo=
rder-image: none; text-align: left; color: rgb(34, 34, 34); text-transform:=
 none; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-vari=
ant: normal; word-spacing: 0px; display: inline; white-space: normal; orpha=
ns: 2; float: none; -webkit-text-stroke-width: 0px; background-color: trans=
parent;"><span style=3D"background-color: transparent; border-bottom-color:=
 rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; bord=
er-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%;=
 border-image-source: none; border-image-width: 1; border-left-color: rgb(3=
4, 34, 34); border-left-style: none; border-left-width: 0px; border-right-c=
olor: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; b=
order-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width:=
 0px; color: rgb(34, 34, 34); display: inline; float: none; font-family: &a=
mp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif; font-size=
: 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-=
spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; m=
argin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding=
-right: 0px; padding-top: 0px; text-align: left; text-decoration: none; tex=
t-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-=
space: normal; word-spacing: 0px;">observer_ptr&lt;const A&gt; _p;</span><b=
></b></span></span></font></div><div><font face=3D"courier new,monospace">}=
;=C2=A0</font></div><div><font face=3D"courier new"><br></font></div><div><=
font face=3D"arial,sans-serif">observer_ptr will monitor addressof(*_p) for=
 ~A() call. The scope of monitoring is ~<span style=3D"text-align: left; co=
lor: rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter-spacin=
g: normal; font-size: 13px; font-style: normal; font-variant: normal; font-=
weight: 400; text-decoration: none; word-spacing: 0px; display: inline !imp=
ortant; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-w=
idth: 0px; background-color: transparent;">observer_ptr() or release() call=
..</span></font></div><div><font face=3D"arial,sans-serif"><span style=3D"te=
xt-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent: =
0px; letter-spacing: normal; font-size: 13px; font-style: normal; font-vari=
ant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; di=
splay: inline !important; white-space: normal; orphans: 2; float: none; -we=
bkit-text-stroke-width: 0px; background-color: transparent;"><br></span></f=
ont></div><div><font face=3D"arial,sans-serif"><span style=3D"text-align: l=
eft; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter=
-spacing: normal; font-size: 13px; font-style: normal; font-variant: normal=
; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inli=
ne !important; white-space: normal; orphans: 2; float: none; -webkit-text-s=
troke-width: 0px; background-color: transparent;">Copies of=C2=A0<span styl=
e=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); border-image: =
none; text-align: left; color: rgb(34, 34, 34); text-transform: none; text-=
indent: 0px; letter-spacing: normal; font-size: 13px; font-style: normal; f=
ont-variant: normal; font-weight: 400; text-decoration: none; word-spacing:=
 0px; display: inline; white-space: normal; orphans: 2; float: none; -webki=
t-text-stroke-width: 0px; background-color: transparent;"><span style=3D"ba=
ckground-color: transparent; border-bottom-color: rgb(34, 34, 34); border-b=
ottom-style: none; border-bottom-width: 0px; border-image-outset: 0; border=
-image-repeat: stretch; border-image-slice: 100%; border-image-source: none=
; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-st=
yle: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); bor=
der-right-style: none; border-right-width: 0px; border-top-color: rgb(34, 3=
4, 34); border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 3=
4); display: inline; float: none; font-size: 13px; font-style: normal; font=
-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: =
0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padd=
ing-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; t=
ext-align: left; text-decoration: none; text-indent: 0px; text-transform: n=
one; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px=
;"><span style=3D"background-color: transparent; border-bottom-color: rgb(3=
4, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-ima=
ge-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; borde=
r-image-source: none; border-image-width: 1; border-left-color: rgb(34, 34,=
 34); border-left-style: none; border-left-width: 0px; border-right-color: =
rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; border-=
top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; =
color: rgb(34, 34, 34); display: inline; float: none; font-size: 13px; font=
-style: normal; font-variant: normal; font-weight: 400; letter-spacing: nor=
mal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0=
px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px;=
 padding-top: 0px; text-align: left; text-decoration: none; text-indent: 0p=
x; text-transform: none; -webkit-text-stroke-width: 0px; white-space: norma=
l; word-spacing: 0px;"><font face=3D"arial,sans-serif">observer_ptr still m=
onitor the same address, but with a different scope - their dtor, release o=
r reset.</font></span></span></span></span></font><font face=3D"arial,sans-=
serif"><span style=3D"text-align: left; color: rgb(34, 34, 34); text-transf=
orm: none; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-=
style: normal; font-variant: normal; font-weight: 400; text-decoration: non=
e; word-spacing: 0px; display: inline !important; white-space: normal; orph=
ans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: tran=
sparent;"><span style=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34,=
 34); border-image: none; text-align: left; color: rgb(34, 34, 34); text-tr=
ansform: none; text-indent: 0px; letter-spacing: normal; font-size: 13px; f=
ont-style: normal; font-variant: normal; font-weight: 400; text-decoration:=
 none; word-spacing: 0px; display: inline; white-space: normal; orphans: 2;=
 float: none; -webkit-text-stroke-width: 0px; background-color: transparent=
;"><span style=3D"background-color: transparent; border-bottom-color: rgb(3=
4, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-ima=
ge-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; borde=
r-image-source: none; border-image-width: 1; border-left-color: rgb(34, 34,=
 34); border-left-style: none; border-left-width: 0px; border-right-color: =
rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; border-=
top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; =
color: rgb(34, 34, 34); display: inline; float: none; font-size: 13px; font=
-style: normal; font-variant: normal; font-weight: 400; letter-spacing: nor=
mal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0=
px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px;=
 padding-top: 0px; text-align: left; text-decoration: none; text-indent: 0p=
x; text-transform: none; -webkit-text-stroke-width: 0px; white-space: norma=
l; word-spacing: 0px;"><span style=3D"background-color: transparent; border=
-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-wi=
dth: 0px; border-image-outset: 0; border-image-repeat: stretch; border-imag=
e-slice: 100%; border-image-source: none; border-image-width: 1; border-lef=
t-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; =
border-right-color: rgb(34, 34, 34); border-right-style: none; border-right=
-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; bor=
der-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: none; f=
ont-size: 13px; font-style: normal; font-variant: normal; font-weight: 400;=
 letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right=
: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px;=
 padding-right: 0px; padding-top: 0px; text-align: left; text-decoration: n=
one; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px=
; white-space: normal; word-spacing: 0px;"></span></span></span></span></fo=
nt></div><div><font face=3D"arial,sans-serif"><span style=3D"text-align: le=
ft; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter-=
spacing: normal; font-size: 13px; font-style: normal; font-variant: normal;=
 font-weight: 400; text-decoration: none; word-spacing: 0px; display: inlin=
e !important; white-space: normal; orphans: 2; float: none; -webkit-text-st=
roke-width: 0px; background-color: transparent;"><span style=3D"margin: 0px=
; padding: 0px; border: 0px rgb(34, 34, 34); border-image: none; text-align=
: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; let=
ter-spacing: normal; font-size: 13px; font-style: normal; font-variant: nor=
mal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: i=
nline; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-wi=
dth: 0px; background-color: transparent;"><span style=3D"background-color: =
transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-style: non=
e; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: s=
tretch; border-image-slice: 100%; border-image-source: none; border-image-w=
idth: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; borde=
r-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style:=
 none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-t=
op-style: none; border-top-width: 0px; color: rgb(34, 34, 34); display: inl=
ine; float: none; font-size: 13px; font-style: normal; font-variant: normal=
; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left=
: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px;=
 padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left;=
 text-decoration: none; text-indent: 0px; text-transform: none; -webkit-tex=
t-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><span style=
=3D"background-color: transparent; border-bottom-color: rgb(34, 34, 34); bo=
rder-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; =
border-image-repeat: stretch; border-image-slice: 100%; border-image-source=
: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-l=
eft-style: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34=
); border-right-style: none; border-right-width: 0px; border-top-color: rgb=
(34, 34, 34); border-top-style: none; border-top-width: 0px; color: rgb(34,=
 34, 34); display: inline; float: none; font-size: 13px; font-style: normal=
; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bo=
ttom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2=
; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: =
0px; text-align: left; text-decoration: none; text-indent: 0px; text-transf=
orm: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacin=
g: 0px;"><br></span></span></span></span></font></div><font face=3D"arial,s=
ans-serif"><span style=3D"text-align: left; color: rgb(34, 34, 34); text-tr=
ansform: none; text-indent: 0px; letter-spacing: normal; font-size: 13px; f=
ont-style: normal; font-variant: normal; font-weight: 400; text-decoration:=
 none; word-spacing: 0px; display: inline !important; white-space: normal; =
orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: =
transparent;"><span style=3D"margin: 0px; padding: 0px; border: 0px rgb(34,=
 34, 34); border-image: none; text-align: left; color: rgb(34, 34, 34); tex=
t-transform: none; text-indent: 0px; letter-spacing: normal; font-size: 13p=
x; font-style: normal; font-variant: normal; font-weight: 400; text-decorat=
ion: none; word-spacing: 0px; display: inline; white-space: normal; orphans=
: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transpa=
rent;"><span style=3D"background-color: transparent; border-bottom-color: r=
gb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border=
-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; b=
order-image-source: none; border-image-width: 1; border-left-color: rgb(34,=
 34, 34); border-left-style: none; border-left-width: 0px; border-right-col=
or: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; bor=
der-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0=
px; color: rgb(34, 34, 34); display: inline; float: none; font-size: 13px; =
font-style: normal; font-variant: normal; font-weight: 400; letter-spacing:=
 normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-to=
p: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: =
0px; padding-top: 0px; text-align: left; text-decoration: none; text-indent=
: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: n=
ormal; word-spacing: 0px;"><span style=3D"background-color: transparent; bo=
rder-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-botto=
m-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-=
image-slice: 100%; border-image-source: none; border-image-width: 1; border=
-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0=
px; border-right-color: rgb(34, 34, 34); border-right-style: none; border-r=
ight-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none;=
 border-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: non=
e; font-size: 13px; font-style: normal; font-variant: normal; font-weight: =
400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-r=
ight: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: =
0px; padding-right: 0px; padding-top: 0px; text-align: left; text-decoratio=
n: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width:=
 0px; white-space: normal; word-spacing: 0px;"><div><br></div></span></span=
></span></span></font><div><font face=3D"arial,sans-serif"><span style=3D"t=
ext-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent:=
 0px; letter-spacing: normal; font-size: 13px; font-style: normal; font-var=
iant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; d=
isplay: inline !important; white-space: normal; orphans: 2; float: none; -w=
ebkit-text-stroke-width: 0px; background-color: transparent;"><span style=
=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); border-image: n=
one; text-align: left; color: rgb(34, 34, 34); text-transform: none; text-i=
ndent: 0px; letter-spacing: normal; font-size: 13px; font-style: normal; fo=
nt-variant: normal; font-weight: 400; text-decoration: none; word-spacing: =
0px; display: inline; white-space: normal; orphans: 2; float: none; -webkit=
-text-stroke-width: 0px; background-color: transparent;"><span style=3D"bac=
kground-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bo=
ttom-style: none; border-bottom-width: 0px; border-image-outset: 0; border-=
image-repeat: stretch; border-image-slice: 100%; border-image-source: none;=
 border-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-sty=
le: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); bord=
er-right-style: none; border-right-width: 0px; border-top-color: rgb(34, 34=
, 34); border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34=
); display: inline; float: none; font-size: 13px; font-style: normal; font-=
variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0=
px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; paddi=
ng-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; te=
xt-align: left; text-decoration: none; text-indent: 0px; text-transform: no=
ne; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;=
"><span style=3D"background-color: transparent; border-bottom-color: rgb(34=
, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-imag=
e-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border=
-image-source: none; border-image-width: 1; border-left-color: rgb(34, 34, =
34); border-left-style: none; border-left-width: 0px; border-right-color: r=
gb(34, 34, 34); border-right-style: none; border-right-width: 0px; border-t=
op-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; c=
olor: rgb(34, 34, 34); display: inline; float: none; font-size: 13px; font-=
style: normal; font-variant: normal; font-weight: 400; letter-spacing: norm=
al; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0p=
x; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; =
padding-top: 0px; text-align: left; text-decoration: none; text-indent: 0px=
; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal=
; word-spacing: 0px;">That is a major difference from lifetime extension - =
we can have many-to-one mapping without any semantic or implementation prob=
lems.=C2=A0<span style=3D"display: inline !important; float: none; backgrou=
nd-color: transparent; color: rgb(34, 34, 34); font-family: arial,sans-seri=
f; font-size: 13px; font-style: normal; font-variant: normal; font-weight: =
400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration:=
 none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0=
px; white-space: normal; word-spacing: 0px;">Lifetime extension does not al=
low copies of a view/ref to extend with the lifetime of the object.</span><=
/span></span></span></span></font></div><div><font face=3D"arial,sans-serif=
"><span style=3D"text-align: left; color: rgb(34, 34, 34); text-transform: =
none; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-style=
: normal; font-variant: normal; font-weight: 400; text-decoration: none; wo=
rd-spacing: 0px; display: inline !important; white-space: normal; orphans: =
2; float: none; -webkit-text-stroke-width: 0px; background-color: transpare=
nt;"><span style=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34);=
 border-image: none; text-align: left; color: rgb(34, 34, 34); text-transfo=
rm: none; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-s=
tyle: normal; font-variant: normal; font-weight: 400; text-decoration: none=
; word-spacing: 0px; display: inline; white-space: normal; orphans: 2; floa=
t: none; -webkit-text-stroke-width: 0px; background-color: transparent;"><s=
pan style=3D"background-color: transparent; border-bottom-color: rgb(34, 34=
, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-ou=
tset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-ima=
ge-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34);=
 border-left-style: none; border-left-width: 0px; border-right-color: rgb(3=
4, 34, 34); border-right-style: none; border-right-width: 0px; border-top-c=
olor: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color=
: rgb(34, 34, 34); display: inline; float: none; font-size: 13px; font-styl=
e: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; =
margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; o=
rphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padd=
ing-top: 0px; text-align: left; text-decoration: none; text-indent: 0px; te=
xt-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; wo=
rd-spacing: 0px;"><span style=3D"background-color: transparent; border-bott=
om-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: =
0px; border-image-outset: 0; border-image-repeat: stretch; border-image-sli=
ce: 100%; border-image-source: none; border-image-width: 1; border-left-col=
or: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; borde=
r-right-color: rgb(34, 34, 34); border-right-style: none; border-right-widt=
h: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border-t=
op-width: 0px; color: rgb(34, 34, 34); display: inline; float: none; font-s=
ize: 13px; font-style: normal; font-variant: normal; font-weight: 400; lett=
er-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px=
; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padd=
ing-right: 0px; padding-top: 0px; text-align: left; text-decoration: none; =
text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; whi=
te-space: normal; word-spacing: 0px;">We are also not limited to initializa=
tion only - the monitoring can (re)start at the call of reset() instead on =
constructor call only. Lifetime extension deals with initialization exclusi=
vely.=C2=A0</span></span></span></span></font></div><div><font face=3D"aria=
l,sans-serif"><span style=3D"text-align: left; color: rgb(34, 34, 34); text=
-transform: none; text-indent: 0px; letter-spacing: normal; font-size: 13px=
; font-style: normal; font-variant: normal; font-weight: 400; text-decorati=
on: none; word-spacing: 0px; display: inline !important; white-space: norma=
l; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-colo=
r: transparent;"><span style=3D"margin: 0px; padding: 0px; border: 0px rgb(=
34, 34, 34); border-image: none; text-align: left; color: rgb(34, 34, 34); =
text-transform: none; text-indent: 0px; letter-spacing: normal; font-size: =
13px; font-style: normal; font-variant: normal; font-weight: 400; text-deco=
ration: none; word-spacing: 0px; display: inline; white-space: normal; orph=
ans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: tran=
sparent;"><span style=3D"background-color: transparent; border-bottom-color=
: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; bor=
der-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%=
; border-image-source: none; border-image-width: 1; border-left-color: rgb(=
34, 34, 34); border-left-style: none; border-left-width: 0px; border-right-=
color: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; =
border-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width=
: 0px; color: rgb(34, 34, 34); display: inline; float: none; font-size: 13p=
x; font-style: normal; font-variant: normal; font-weight: 400; letter-spaci=
ng: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin=
-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-righ=
t: 0px; padding-top: 0px; text-align: left; text-decoration: none; text-ind=
ent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space=
: normal; word-spacing: 0px;"><span style=3D"background-color: transparent;=
 border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bo=
ttom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; bord=
er-image-slice: 100%; border-image-source: none; border-image-width: 1; bor=
der-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width=
: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; borde=
r-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: no=
ne; border-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: =
none; font-size: 13px; font-style: normal; font-variant: normal; font-weigh=
t: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margi=
n-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-lef=
t: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-decora=
tion: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-wid=
th: 0px; white-space: normal; word-spacing: 0px;"><br></span></span></span>=
</span></font></div><div><font face=3D"arial,sans-serif"><span style=3D"tex=
t-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0=
px; letter-spacing: normal; font-size: 13px; font-style: normal; font-varia=
nt: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; dis=
play: inline !important; white-space: normal; orphans: 2; float: none; -web=
kit-text-stroke-width: 0px; background-color: transparent;"><span style=3D"=
margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); border-image: none;=
 text-align: left; color: rgb(34, 34, 34); text-transform: none; text-inden=
t: 0px; letter-spacing: normal; font-size: 13px; font-style: normal; font-v=
ariant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px;=
 display: inline; white-space: normal; orphans: 2; float: none; -webkit-tex=
t-stroke-width: 0px; background-color: transparent;"><span style=3D"backgro=
und-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom=
-style: none; border-bottom-width: 0px; border-image-outset: 0; border-imag=
e-repeat: stretch; border-image-slice: 100%; border-image-source: none; bor=
der-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: =
none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-r=
ight-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34=
); border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); d=
isplay: inline; float: none; font-size: 13px; font-style: normal; font-vari=
ant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; =
margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding-b=
ottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-a=
lign: left; text-decoration: none; text-indent: 0px; text-transform: none; =
-webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><s=
pan style=3D"background-color: transparent; border-bottom-color: rgb(34, 34=
, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-ou=
tset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-ima=
ge-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34);=
 border-left-style: none; border-left-width: 0px; border-right-color: rgb(3=
4, 34, 34); border-right-style: none; border-right-width: 0px; border-top-c=
olor: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color=
: rgb(34, 34, 34); display: inline; float: none; font-size: 13px; font-styl=
e: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; =
margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; o=
rphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padd=
ing-top: 0px; text-align: left; text-decoration: none; text-indent: 0px; te=
xt-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; wo=
rd-spacing: 0px;"><br></span></span></span></span></font></div><div>How can=
 perfect forwarding interfere in all this?=C2=A0</div><div><br></div><div><=
br></div><div><font face=3D"courier new,monospace">template&lt;typename T, =
typename ...Args&gt;<br>auto init(Args&amp;&amp;... arg)<br>{<br>=C2=A0 ret=
urn T(std::forward&lt;Args&gt;(arg)...); //&lt; observer_ptr starts monitor=
ing &amp;arg<br>}<br><br>int main()<br>{ <br>=C2=A0 auto v =3D init&lt;A_vi=
ew&gt;(A{}); //&lt; both A_view and A allocated. A_view usable before the &=
#39;;&#39; when ~A is called<br>}</font></div><div><font face=3D"courier ne=
w"><br></font></div><div>If copy elision does not kick-in nothing changes -=
 copy is safe and defined, lifetime of A is the same.</div><div><br></div><=
div>If we pass arguments and create A in init() instead ( <font face=3D"cou=
rier new,monospace">return</font>=C2=A0 <span style=3D"display: inline !imp=
ortant; float: none; background-color: transparent; color: rgb(34, 34, 34);=
 font-family: courier new,monospace; font-size: 13px; font-style: normal; f=
ont-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: left; text-decoration: none; text-indent: 0px; text-transform: =
none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0p=
x;">T(A(std::forward&lt;Args&gt;(arg)...)); </span>), then the <font face=
=3D"courier new,monospace">observer_ptr </font>is still created with a vali=
d address, </div><div>however, after we return will not be able to use<font=
 face=3D"courier new,monospace"> A_view</font> in any way, including before=
 the <font face=3D"courier new,monospace">&#39;;&#39;.=C2=A0</font></div><d=
iv><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><font face=
=3D"courier new,monospace"><br></font></div><div>If both there is no elisio=
n and A is created when initializing T inside init, then the returned view =
can be created from a dangling view.=C2=A0</div><div>We could allow views f=
rom dangling views to be created, however=C2=A0<span style=3D"display: inli=
ne !important; float: none; background-color: transparent; color: rgb(34, 3=
4, 34); font-family: &quot;Arial&quot;,&quot;Helvetica&quot;,sans-serif; fo=
nt-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; =
letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none=
; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; w=
hite-space: normal; word-spacing: 0px;">no dtor will be monitored and</span=
> all uses of the view will be illegal until destroyed/reset/release-ed. </=
div><div>We could also issue a warning on coping from dangling view without=
 problem.</div><div><br></div><div><br></div><div><br></div><div><font face=
=3D"arial,sans-serif"><b><i><br></i></b></font></div><div>=C2=A0</div></div=
>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/4fa792ec-1f51-4357-a65a-2ce3c10c60c0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/4fa792ec-1f51-4357-a65a-2ce3c10c60c0=
%40isocpp.org</a>.<br />

------=_Part_1840_749971179.1516446729101--

------=_Part_1839_156315941.1516446729100--

.
