220 7336 <CAPBZbvxNoA-3idKarWwMv+NTeZXafQX2tpFfu7XWaqg0TnJ2yQ@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: "Billy O'Neal" <billy.oneal@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Suggestion: ostringstream::move_str()
Date: Wed, 16 Oct 2013 19:38:04 -0700
Lines: 162
Approved: news@gmane.org
Message-ID: <CAPBZbvxNoA-3idKarWwMv+NTeZXafQX2tpFfu7XWaqg0TnJ2yQ@mail.gmail.com>
References: <8d70b552-2ec1-45e7-9afb-dee28d73438a@isocpp.org> <4291267.ToRBPx4CWi@tjmaciei-mobl2>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=089e0158a92e6e99da04e8e6b72a
X-Trace: ger.gmane.org 1381977521 32589 80.91.229.3 (17 Oct 2013 02:38:41 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 17 Oct 2013 02:38:41 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDKLBLVE6ADBBNE37WJAKGQEEUFKJ3I@isocpp.org Thu Oct 17 04:38:47 2013
Return-path: <std-proposals+bncBDKLBLVE6ADBBNE37WJAKGQEEUFKJ3I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f199.google.com ([209.85.223.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDKLBLVE6ADBBNE37WJAKGQEEUFKJ3I@isocpp.org>)
	id 1VWdU6-0002FW-PJ
	for gclcip-std-proposals@m.gmane.org; Thu, 17 Oct 2013 04:38:47 +0200
Original-Received: by mail-ie0-f199.google.com with SMTP id qd12sf4465692ieb.6
        for <gclcip-std-proposals@m.gmane.org>; Wed, 16 Oct 2013 19:38:45 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=TItI1Aa+9BVljhpjy/PTkndP1OzOrmn33zDKvhf2ji0=;
        b=RVl26KDWWl7yLJBx9lPRvR1JP2ZB0pbqAJxKlJbjzR/xmPWUaiO9xBZXWxOuJH8M5W
         B5IG7ZKPPM8D2f/p9xB65N/w8hNusr+HpDxpMQA/bnF5WXw/uzux3BP5KINZxuKJ5wE2
         xzONhWUv0NW7s5FiyD/y2ScdU6Aaja3E48TmpRPbPaqV/Ech1aSLBl84Buo0DD3Qkre9
         rxLo4U1S+6KdPArloBmTTf5OMNL5eAZ+L8vkWmIc/uG8H676YkIAFeOAaQHBN60eVC+U
         pohcSBseUXwNYkH0/t3gAtpK1t2CR2MwPrwg6FPeNkGxGKc6gO404EsZZX+FwAenco6S
         VooA==
X-Received: by 10.50.3.40 with SMTP id 8mr364045igz.1.1381977525776;
        Wed, 16 Oct 2013 19:38:45 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.241.168 with SMTP id wj8ls255330obc.57.gmail; Wed, 16 Oct
 2013 19:38:44 -0700 (PDT)
X-Received: by 10.182.40.134 with SMTP id x6mr10040400obk.31.1381977524686;
        Wed, 16 Oct 2013 19:38:44 -0700 (PDT)
Original-Received: from mail-ob0-x233.google.com (mail-ob0-x233.google.com [2607:f8b0:4003:c01::233])
        by mx.google.com with ESMTPS id ii9si7013957obc.102.1969.12.31.16.00.00
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 16 Oct 2013 19:38:44 -0700 (PDT)
Received-SPF: pass (google.com: domain of billy.oneal@gmail.com designates 2607:f8b0:4003:c01::233 as permitted sender) client-ip=2607:f8b0:4003:c01::233;
Original-Received: by mail-ob0-f179.google.com with SMTP id wp18so1386051obc.10
        for <std-proposals@isocpp.org>; Wed, 16 Oct 2013 19:38:44 -0700 (PDT)
X-Received: by 10.182.99.231 with SMTP id et7mr10143312obb.10.1381977524441;
 Wed, 16 Oct 2013 19:38:44 -0700 (PDT)
Original-Received: by 10.182.87.37 with HTTP; Wed, 16 Oct 2013 19:38:04 -0700 (PDT)
In-Reply-To: <4291267.ToRBPx4CWi@tjmaciei-mobl2>
X-Original-Sender: billy.oneal@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of billy.oneal@gmail.com designates 2607:f8b0:4003:c01::233 as
 permitted sender) smtp.mail=billy.oneal@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:7336
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7336>

--089e0158a92e6e99da04e8e6b72a
Content-Type: text/plain; charset=ISO-8859-1

Is an implementation permitted to add an overload like this?

string*&&* str() *&&*
{
     /* ... */
}

Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com


On Wed, Oct 16, 2013 at 7:05 PM, Thiago Macieira <thiago@macieira.org>wrote:

> On quarta-feira, 16 de outubro de 2013 18:46:18, jgottman6@gmail.comwrote:
> > The method os.str() returns a string that is a copy of the collected
> state
> > of the ostringstream.  It has to be, because it is possible to write more
> > values to os later.  But in this function, it is not necessary to
> maintain
> > the state of the ostringstream, since it is about to be destructed
> anyway.
> > It would therefore be very nice to be able to return a version of
> > ostringstream::str() that steals the guts of the ostringstream, using
> > something like move semantics, and uses them to construct the returned
> > string more efficiently than by a copy  Is this technically feasible?
> >
> > Joe Gottman
>
> This was discussed in the past month.
>
> The problem is that the standard does not require ostringstream to be
> actually
> backed by a string. It might use different kinds of buffers, including
> multiple
> ones. Therefore, it's not possible to mandate that it actually moves
> anything.
>
> At best, we could add a way to potentially do it, but not guarantee that.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>    Software Architect - Intel Open Source Technology Center
>       PGP/GPG: 0x6EF45358; fingerprint:
>       E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
>
> --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--089e0158a92e6e99da04e8e6b72a
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Is an implementation permitted to add an overload like thi=
s?<div><br></div><div>string<b>&amp;&amp;</b> str() <b>&amp;&amp;</b></div>=
<div>{</div><div>=A0 =A0 =A0/* ... */</div><div>}<br><div class=3D"gmail_ex=
tra"><br clear=3D"all">

<div><div dir=3D"ltr"><div>Billy O&#39;Neal</div><div><a href=3D"https://bi=
tbucket.org/BillyONeal/" target=3D"_blank">https://github.com/BillyONeal/</=
a></div><div><a href=3D"http://stackoverflow.com/users/82320/billy-oneal" t=
arget=3D"_blank">http://stackoverflow.com/users/82320/billy-oneal</a></div>

<div>Malware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Wed, Oct 16, 2013 at 7:05 PM, Thiago =
Macieira <span dir=3D"ltr">&lt;<a href=3D"mailto:thiago@macieira.org" targe=
t=3D"_blank">thiago@macieira.org</a>&gt;</span> wrote:<br><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">

On quarta-feira, 16 de outubro de 2013 18:46:18, <a href=3D"mailto:jgottman=
6@gmail.com">jgottman6@gmail.com</a> wrote:<br>
&gt; The method os.str() returns a string that is a copy of the collected s=
tate<br>
&gt; of the ostringstream. =A0It has to be, because it is possible to write=
 more<br>
&gt; values to os later. =A0But in this function, it is not necessary to ma=
intain<br>
&gt; the state of the ostringstream, since it is about to be destructed any=
way.<br>
&gt; It would therefore be very nice to be able to return a version of<br>
&gt; ostringstream::str() that steals the guts of the ostringstream, using<=
br>
&gt; something like move semantics, and uses them to construct the returned=
<br>
&gt; string more efficiently than by a copy =A0Is this technically feasible=
?<br>
&gt;<br>
&gt; Joe Gottman<br>
<br>
This was discussed in the past month.<br>
<br>
The problem is that the standard does not require ostringstream to be actua=
lly<br>
backed by a string. It might use different kinds of buffers, including mult=
iple<br>
ones. Therefore, it&#39;s not possible to mandate that it actually moves an=
ything.<br>
<br>
At best, we could add a way to potentially do it, but not guarantee that.<b=
r>
<span class=3D"HOEnZb"><font color=3D"#888888"><br>
--<br>
Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" target=3D"_b=
lank">macieira.info</a> - thiago (AT) <a href=3D"http://kde.org" target=3D"=
_blank">kde.org</a><br>
=A0 =A0Software Architect - Intel Open Source Technology Center<br>
=A0 =A0 =A0 PGP/GPG: 0x6EF45358; fingerprint:<br>
=A0 =A0 =A0 E067 918B B660 DBD1 105C =A0966C 33F5 F005 6EF4 5358<br>
<br>
--<br>
<br>
---<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%2Bunsubscribe@isocpp.org">std-propo=
sals+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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--089e0158a92e6e99da04e8e6b72a--

.
