220 31910 <CAF8PYMi+6VjCUvVTTvVKOCg9xTxV8mS8CLz3VpLLpqVpKYzzhA@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Vitali Lovich <vlovich@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: This variable should not be named: an identifier
 (not) to remember
Date: Thu, 30 Mar 2017 21:41:56 +0000
Lines: 151
Approved: news@gmane.org
Message-ID: <CAF8PYMi+6VjCUvVTTvVKOCg9xTxV8mS8CLz3VpLLpqVpKYzzhA@mail.gmail.com>
References: <985b9b2a-c734-45eb-95f4-db4dc0d309a1@isocpp.org>
 <2235919.4GAIbDEcRC@tjmaciei-mobl1> <CAF8PYMgi7mk_fHs=cyYhW4rQad6uDLXrFd7Ef2m7g8Q143p2eg@mail.gmail.com>
 <3760122.IY8cFr858X@tjmaciei-mobl1> <CAF8PYMgR_=QtP094+ZyER=ymjZQ_TmtbU7eYYh9wLWDV-FmzJw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a113cff84817262054bf990a2
X-Trace: blaine.gmane.org 1490910127 28464 195.159.176.226 (30 Mar 2017 21:42:07 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 30 Mar 2017 21:42:07 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCFIZX46Q4HRBL7X6XDAKGQER3LSCDY@isocpp.org Thu Mar 30 23:42:03 2017
Return-path: <std-proposals+bncBCFIZX46Q4HRBL7X6XDAKGQER3LSCDY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pg0-f70.google.com ([74.125.83.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCFIZX46Q4HRBL7X6XDAKGQER3LSCDY@isocpp.org>)
	id 1cthpS-0006sS-LT
	for gclcip-std-proposals@m.gmane.org; Thu, 30 Mar 2017 23:42:02 +0200
Original-Received: by mail-pg0-f70.google.com with SMTP id 81sf59230428pgh.3
        for <gclcip-std-proposals@m.gmane.org>; Thu, 30 Mar 2017 14:42:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=bO+VK19TYUcgHNmrBPXc+4yHDzy+HNZi9CHSCPGkAD8=;
        b=ZdIQ05hqzXc3LPS1WYxbRQtYF8CNWnIPxP4fiP7aoO9wXYGIRBX2jtL8Bq2Fh5awRU
         0ams56mAYntPYayn9xkVRsG/41H8uWEl283d8ar19AlgpuO47onGG87SHFfVadGqY33p
         oU5c+0BUhVTEg0OTdsvqu0x0FOtFR2/r7XKKYkCWjFBzFwqfEHUV46HF2UoHxecojpTF
         h9GpQ5iAVufJ3x4oMp8RZNMyQOOflipPKbPir/k5ieSNMomT/Xqiuyza/Q7CimuYSeHa
         aGhWNyN+UyqmQcTU2WizwAXPoHWGGQgPNoVcRx5AZwY7+/HIh24Z0ogXIM21vX3P6wZz
         A5oQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=bO+VK19TYUcgHNmrBPXc+4yHDzy+HNZi9CHSCPGkAD8=;
        b=OzRynFlf7AD6yNAzxvKsfy12QpYjNCMK9byH7sSsl55x7ClrfSNANBmxESXTKrhYHD
         TkjhXwi1pI4IHWIGfbrcpxgFpBERAJgG+Ld3D+z4EGdGFk61Db4A1NWit5rXWya4RBMH
         a0RjRmCLZSxrmv5jpgzhVmj3QhKiHO9U7hisBjO2VO9KCv1acE993uMKSZ//TFzYBX+T
         XAV685iBkQz6yAF7VCNtRvtKamvUwq/8hDfzH9D49iLYDLAITjSqm4Ikht15SlfwsAT1
         XTWUEKtk4v43piFkwC9CBj6711IGHfJ2ALTRBBE5gCZqHHKgO2a36rHZxvdUFflnotOf
         ct/g==
X-Gm-Message-State: AFeK/H1nUVQfdX8aZWixT7OOP1legwTXlAOBfzczYtD+Rn9sWo3FmvO2wb1mS9VlNlmPAw==
X-Received: by 10.99.185.21 with SMTP id z21mr727195pge.40.1490910128209;
        Thu, 30 Mar 2017 14:42:08 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.43.209 with SMTP id u75ls1266801ota.13.gmail; Thu, 30 Mar
 2017 14:42:07 -0700 (PDT)
X-Received: by 10.157.60.99 with SMTP id j32mr1362331ote.172.1490910127460;
        Thu, 30 Mar 2017 14:42:07 -0700 (PDT)
Original-Received: from mail-oi0-x231.google.com (mail-oi0-x231.google.com. [2607:f8b0:4003:c06::231])
        by mx.google.com with ESMTPS id g69si1700994otg.12.2017.03.30.14.42.07
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 30 Mar 2017 14:42:07 -0700 (PDT)
Received-SPF: pass (google.com: domain of vlovich@gmail.com designates 2607:f8b0:4003:c06::231 as permitted sender) client-ip=2607:f8b0:4003:c06::231;
Original-Received: by mail-oi0-x231.google.com with SMTP id o67so44196344oib.1
        for <std-proposals@isocpp.org>; Thu, 30 Mar 2017 14:42:07 -0700 (PDT)
X-Received: by 10.157.45.54 with SMTP id v51mr1356935ota.220.1490910126893;
 Thu, 30 Mar 2017 14:42:06 -0700 (PDT)
In-Reply-To: <CAF8PYMgR_=QtP094+ZyER=ymjZQ_TmtbU7eYYh9wLWDV-FmzJw@mail.gmail.com>
X-Original-Sender: vlovich@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of vlovich@gmail.com
 designates 2607:f8b0:4003:c06::231 as permitted sender) smtp.mailfrom=vlovich@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <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:31910
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31910>

--001a113cff84817262054bf990a2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Ah. But I forgot now that with structured binding there's a hidden local
variable anyway for the tuple itself.  I was thinking the compiler was
smart and applied RVO to the individual elements directly.

On Thu, Mar 30, 2017 at 2:40 PM Vitali Lovich <vlovich@gmail.com> wrote:

> tuple<shared_ptr<string>, string_view> getstr()
>
> The 2nd argument is a view into the string owned by shared_ptr.
>
> The semantics of whether or not the string view points to owned memory
> depends on the lifetime of the shared_ptr and my understanding of what yo=
u
> were saying is that the lifetime changes depending on whether the get() i=
s
> done or ignored.
>
> On Wed, Mar 29, 2017 at 9:12 PM Thiago Macieira <thiago@macieira.org>
> wrote:
>
> On quarta-feira, 29 de mar=C3=A7o de 2017 20:41:37 PDT Vitali Lovich wrot=
e:
> > > It does not, so it cannot have an observable effect.
> >
> > doesnt it? If a function returns a Shared_ptr of a string and string_vi=
ew
> > that references the string, if you do:
>
> Can you be more specific what this function returns? "A shared_ptr of a
> string
> and a string_view" does not make sense, since shared_ptr only takes one
> template parameter.
>
> I'll analyse the rest when you post your reply.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>    Software Architect - Intel Open Source Technology Center
>
> --
> 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/3760122.IY8c=
Fr858X%40tjmaciei-mobl1
> .
>
>

--=20
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 e=
mail 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/CAF8PYMi%2B6VjCUvVTTvVKOCg9xTxV8mS8CLz3VpLLpqVpK=
YzzhA%40mail.gmail.com.

--001a113cff84817262054bf990a2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div>Ah. But I forgot now that with structured binding there&#39;s a hidden=
 local variable anyway for the tuple itself.=C2=A0 I was thinking the compi=
ler was smart and applied RVO to the individual elements directly.</div><di=
v><br><div class=3D"gmail_quote"><div>On Thu, Mar 30, 2017 at 2:40 PM Vital=
i Lovich &lt;<a href=3D"mailto:vlovich@gmail.com">vlovich@gmail.com</a>&gt;=
 wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div class=3D"gmail_msg">tu=
ple&lt;shared_ptr&lt;string&gt;, string_view&gt; getstr()</div><div class=
=3D"gmail_msg"><br class=3D"gmail_msg"></div><div class=3D"gmail_msg">The 2=
nd argument is a view into the string owned by shared_ptr.</div><div class=
=3D"gmail_msg"><br class=3D"gmail_msg"></div><div class=3D"gmail_msg">The s=
emantics of whether or not the string view points to owned memory depends o=
n the lifetime of the shared_ptr and my understanding of what you were sayi=
ng is that the lifetime changes depending on whether the get() is done or i=
gnored.</div><div class=3D"gmail_msg"><br class=3D"gmail_msg"><div class=3D=
"gmail_quote gmail_msg"><div class=3D"gmail_msg">On Wed, Mar 29, 2017 at 9:=
12 PM Thiago Macieira &lt;<a href=3D"mailto:thiago@macieira.org" class=3D"g=
mail_msg" target=3D"_blank">thiago@macieira.org</a>&gt; wrote:<br class=3D"=
gmail_msg"></div><blockquote class=3D"gmail_quote gmail_msg" style=3D"margi=
n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On quarta-feira, =
29 de mar=C3=A7o de 2017 20:41:37 PDT Vitali Lovich wrote:<br class=3D"gmai=
l_msg">
&gt; &gt; It does not, so it cannot have an observable effect.<br class=3D"=
gmail_msg">
&gt;<br class=3D"gmail_msg">
&gt; doesnt it? If a function returns a Shared_ptr of a string and string_v=
iew<br class=3D"gmail_msg">
&gt; that references the string, if you do:<br class=3D"gmail_msg">
<br class=3D"gmail_msg">
Can you be more specific what this function returns? &quot;A shared_ptr of =
a string<br class=3D"gmail_msg">
and a string_view&quot; does not make sense, since shared_ptr only takes on=
e<br class=3D"gmail_msg">
template parameter.<br class=3D"gmail_msg">
<br class=3D"gmail_msg">
I&#39;ll analyse the rest when you post your reply.<br class=3D"gmail_msg">
<br class=3D"gmail_msg">
--<br class=3D"gmail_msg">
Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" rel=3D"noref=
errer" class=3D"gmail_msg" target=3D"_blank">macieira.info</a> - thiago (AT=
) <a href=3D"http://kde.org" rel=3D"noreferrer" class=3D"gmail_msg" target=
=3D"_blank">kde.org</a><br class=3D"gmail_msg">
=C2=A0 =C2=A0Software Architect - Intel Open Source Technology Center<br cl=
ass=3D"gmail_msg">
<br class=3D"gmail_msg">
--<br class=3D"gmail_msg">
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br class=3D"gmail_msg=
">
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" class=3D"=
gmail_msg" target=3D"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br c=
lass=3D"gmail_msg">
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" class=3D"gmail_msg" target=3D"_blank">std-proposals@isocpp.org</a>.<b=
r class=3D"gmail_msg">
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3760122.IY8cFr858X%40tjmaciei-mobl1" =
rel=3D"noreferrer" class=3D"gmail_msg" target=3D"_blank">https://groups.goo=
gle.com/a/isocpp.org/d/msgid/std-proposals/3760122.IY8cFr858X%40tjmaciei-mo=
bl1</a>.<br class=3D"gmail_msg">
</blockquote></div></div></blockquote></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/CAF8PYMi%2B6VjCUvVTTvVKOCg9xTxV8mS8CL=
z3VpLLpqVpKYzzhA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAF8PYMi%2B6VjC=
UvVTTvVKOCg9xTxV8mS8CLz3VpLLpqVpKYzzhA%40mail.gmail.com</a>.<br />

--001a113cff84817262054bf990a2--

.
