220 18442 <04ad9302-fccd-4567-a09d-85de7a303b10@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: german.diago@hubblehome.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Exposing string small string optimization size to
 avoid heap allocation.
Date: Fri, 5 Jun 2015 23:51:27 -0700 (PDT)
Lines: 112
Approved: news@gmane.org
Message-ID: <04ad9302-fccd-4567-a09d-85de7a303b10@isocpp.org>
References: <19736033-58d4-441d-ae73-19804f8ef575@isocpp.org>
 <87107DC2-569D-4411-8CCA-548E59529C96@mac.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_318_358007323.1433573487217"
X-Trace: ger.gmane.org 1433573493 30818 80.91.229.3 (6 Jun 2015 06:51:33 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 6 Jun 2015 06:51:33 +0000 (UTC)
Cc: potswa@mac.com
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDKJVOEEVYNRB4FQZKVQKGQEMTKD5WA@isocpp.org Sat Jun 06 08:51:33 2015
Return-path: <std-proposals+bncBDKJVOEEVYNRB4FQZKVQKGQEMTKD5WA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yk0-f198.google.com ([209.85.160.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDKJVOEEVYNRB4FQZKVQKGQEMTKD5WA@isocpp.org>)
	id 1Z17x3-0001si-Ux
	for gclcip-std-proposals@m.gmane.org; Sat, 06 Jun 2015 08:51:30 +0200
Original-Received: by ykfl8 with SMTP id l8sf70193689ykf.0
        for <gclcip-std-proposals@m.gmane.org>; Fri, 05 Jun 2015 23:51:28 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:content-type:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=ZIgSDUjnQeuCVJ+pgq2hSTGp5ycoQ2mJiE3atCWb9sg=;
        b=ln0+4DWElU+nyUBry5orP45+fzvSYn+LNf/bUf5IrihU/XwQ5VnfqxJXZ4MAKRMEIL
         tqLGBByu0oTyhc8QSCITf+XjEbGIwekF7Lm6U4fYOMplqkLWcBvvmiMOtBdconOENhiD
         Fy3MZXj3bT4N9UPFEu1aisipuwneGbUUZ1CjV3PTCWBbYy6PslADG4zBKqPS6aZj/O0K
         30N7VKEQf5G/l8BPoJmUlsoVmDsedMSPcHaG2dOtLJxDP/gMUeCodBKaJb+NuYbs4BIP
         AVKhF8AoIse1csBqEHzVy0YM7h+dESYQyqq1gk3YDTHDL1t6SyO9kjtUWGedYx/XhawI
         ZleA==
X-Gm-Message-State: ALoCoQkhut7COcKOElKMFdolSGvXMik1+UjMJWvB5sS8i+3zbSP41OoESkNmHleVvrImADeU//um
X-Received: by 10.140.236.67 with SMTP id h64mr8893595qhc.13.1433573488871;
        Fri, 05 Jun 2015 23:51:28 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.102.3 with SMTP id fk3ls762194igb.34.gmail; Fri, 05 Jun
 2015 23:51:28 -0700 (PDT)
X-Received: by 10.50.66.141 with SMTP id f13mr30033igt.4.1433573488010;
        Fri, 05 Jun 2015 23:51:28 -0700 (PDT)
In-Reply-To: <87107DC2-569D-4411-8CCA-548E59529C96@mac.com>
X-Original-Sender: german.diago@hubblehome.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: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:18442
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/18442>

------=_Part_318_358007323.1433573487217
Content-Type: multipart/alternative; 
	boundary="----=_Part_319_1927382414.1433573487217"

------=_Part_319_1927382414.1433573487217
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



On Saturday, June 6, 2015 at 12:36:39 PM UTC+7, David Krauss wrote:
>
>
> On 2015=E2=80=9306=E2=80=9306, at 1:14 PM, german...@hubblehome.com <java=
script:> wrote:
>
> Any interest in this?
>
>
> If heap allocation is really unimplemented, it=E2=80=99s already called=
=20
> string::max_size(). And it wouldn=E2=80=99t really be considered an optim=
ization=20
> since there=E2=80=99s no alternative.
>
> I think this is just an implementation-defined constant. Not sure wether =
I=20
am wrong or not. Is that a lot of work?
=20

> Otherwise, I=E2=80=99m not sure what a program would do with it. Chopping=
 the ends=20
> off string literals that don=E2=80=99t need to be self-explanatory? Seems=
 like a=20
> lot of trouble for little gain.
>

A common use case is to have a lot of short strings. I want to store them=
=20
in std::string (maybe) to have some convenience of the operations it=20
provides. If I do not know wether the string will allocate memory, how can=
=20
I use std::strings in the first place?

But maybe (and maybe only, I am not sure) a std::static_string<N> is a=20
better interface for this.=20

Thanks for your feedback.
=20

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_319_1927382414.1433573487217
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Saturday, June 6, 2015 at 12:36:39 PM UTC+7, Da=
vid Krauss wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div style=3D=
"word-wrap:break-word"><br><div><blockquote type=3D"cite"><div>On 2015=E2=
=80=9306=E2=80=9306, at 1:14 PM, <a href=3D"javascript:" target=3D"_blank" =
gdf-obfuscated-mailto=3D"MZKZoV-ZkWUJ" rel=3D"nofollow" onmousedown=3D"this=
..href=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';re=
turn true;">german...@hubblehome.com</a> wrote:</div><br><div><div dir=3D"l=
tr"><div>Any interest in this?</div></div></div></blockquote><br></div><div=
>If heap allocation is really unimplemented, it=E2=80=99s already called <f=
ont face=3D"Courier">string::max_size()</font>. And it wouldn=E2=80=99t rea=
lly be considered an optimization since there=E2=80=99s no alternative.</di=
v><div><br></div></div></blockquote><div>I think this is just an implementa=
tion-defined constant. Not sure wether I am wrong or not. Is that a lot of =
work?</div><div>&nbsp;</div><blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><d=
iv style=3D"word-wrap:break-word"><div></div><div>Otherwise, I=E2=80=99m no=
t sure what a program would do with it. Chopping the ends off string litera=
ls that don=E2=80=99t need to be self-explanatory? Seems like a lot of trou=
ble for little gain.</div></div></blockquote><div><br></div><div>A common u=
se case is to have a lot of short strings. I want to store them in std::str=
ing (maybe) to have some convenience of the operations it provides. If I do=
 not know wether the string will allocate memory, how can I use std::string=
s in the first place?</div><div><br></div><div>But maybe (and maybe only, I=
 am not sure) a std::static_string&lt;N&gt; is a better interface for this.=
&nbsp;</div><div><br></div><div>Thanks for your feedback.</div><div>&nbsp;<=
br></div></div>

<p></p>

-- <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+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 />
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 />

------=_Part_319_1927382414.1433573487217--
------=_Part_318_358007323.1433573487217--

.
