220 7335 <4291267.ToRBPx4CWi@tjmaciei-mobl2> article
Path: news.gmane.org!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Suggestion: ostringstream::move_str()
Date: Wed, 16 Oct 2013 19:05:12 -0700
Lines: 34
Approved: news@gmane.org
Message-ID: <4291267.ToRBPx4CWi@tjmaciei-mobl2>
References: <8d70b552-2ec1-45e7-9afb-dee28d73438a@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1381975513 8454 80.91.229.3 (17 Oct 2013 02:05:13 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 17 Oct 2013 02:05:13 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBW4L7WJAKGQEBQOGX3Y@isocpp.org Thu Oct 17 04:05:18 2013
Return-path: <std-proposals+bncBCB4TK757YBRBW4L7WJAKGQEBQOGX3Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-la0-f72.google.com ([209.85.215.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCB4TK757YBRBW4L7WJAKGQEBQOGX3Y@isocpp.org>)
	id 1VWcxh-0007gM-VH
	for gclcip-std-proposals@m.gmane.org; Thu, 17 Oct 2013 04:05:17 +0200
Original-Received: by mail-la0-f72.google.com with SMTP id eh20sf1823004lab.3
        for <gclcip-std-proposals@m.gmane.org>; Wed, 16 Oct 2013 19:05:17 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=from:to:subject:date:message-id:user-agent:in-reply-to:references
         :mime-version: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=1hFt/W99iO5E0jZ63a4b7zes7s2Ggwutawycn2tL6Qc=;
        b=Tom4CBj2nVE04QKkIFih/vnpBysxC+cVxbXWmYogy0k4tOn4q35akD2cTc6xP5lG1U
         YocV/1hIcUlc+3HDeYejPJLd7Mko5YXjwa3HQwj9xTydiKWKdwge0qGfwq+MWLYA8FJx
         VGYTyMnXtdyc5a/Qs0tCd3ZLOw16LpdXBKyJtON1oeXPMxQABb9B91HuzlHdk8wuqf9g
         TI7n7LR3XhBmFMKWX7Qlve/nAkRw7iX5jsD9lRy2YF4aY3iRQCbWhTRZ+k+FJBmYVhQ1
         U8laxFnrRchaCwp3bmcSSCE0EGtVM5umHDEqYl6vZJAuK2NRaaMHKSmEmOGBJIMMgB3q
         qZxQ==
X-Received: by 10.112.204.41 with SMTP id kv9mr2414949lbc.15.1381975516746;
        Wed, 16 Oct 2013 19:05:16 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.11.105 with SMTP id p9ls1142093wib.31.canary; Wed, 16 Oct
 2013 19:05:15 -0700 (PDT)
X-Received: by 10.14.45.70 with SMTP id o46mr9274288eeb.19.1381975515141;
        Wed, 16 Oct 2013 19:05:15 -0700 (PDT)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [2a01:4f8:d13:f81:21c:14ff:fe01:12a3])
        by mx.google.com with ESMTP id h5si63750783eeg.20.1969.12.31.16.00.00;
        Wed, 16 Oct 2013 19:05:15 -0700 (PDT)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 2a01:4f8:d13:f81:21c:14ff:fe01:12a3 as permitted sender) client-ip=2a01:4f8:d13:f81:21c:14ff:fe01:12a3;
Original-Received: from tjmaciei-mobl2.localnet (unknown [IPv6:2a01:4f8:d13:f81:21c:14ff:fe01:12a3])
	by gondolin.macieira.info (Postfix) with ESMTPSA id A6E0712C005
	for <std-proposals@isocpp.org>; Wed, 16 Oct 2013 19:05:14 -0700 (PDT)
User-Agent: KMail/4.12 pre (Linux/3.9.10-100+i915fix.fc17.x86_64; KDE/4.11.60; x86_64; git-8054221; 2013-08-01)
In-Reply-To: <8d70b552-2ec1-45e7-9afb-dee28d73438a@isocpp.org>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 2a01:4f8:d13:f81:21c:14ff:fe01:12a3
 as permitted sender) smtp.mail=thiago@macieira.org
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:7335
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7335>

On quarta-feira, 16 de outubro de 2013 18:46:18, jgottman6@gmail.com wrote:
> 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/.

.
