220 18437 <0f46f119-457e-4e49-aa64-ab45e0115a21@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 22:28:03 -0700 (PDT)
Lines: 95
Approved: news@gmane.org
Message-ID: <0f46f119-457e-4e49-aa64-ab45e0115a21@isocpp.org>
References: <19736033-58d4-441d-ae73-19804f8ef575@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_246_19031279.1433568483196"
X-Trace: ger.gmane.org 1433568487 17243 80.91.229.3 (6 Jun 2015 05:28:07 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 6 Jun 2015 05:28:07 +0000 (UTC)
Cc: german.diago@hubblehome.com
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDKJVOEEVYNRBZEJZKVQKGQEONSGYLA@isocpp.org Sat Jun 06 07:28:06 2015
Return-path: <std-proposals+bncBDKJVOEEVYNRBZEJZKVQKGQEONSGYLA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f69.google.com ([209.85.220.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDKJVOEEVYNRBZEJZKVQKGQEONSGYLA@isocpp.org>)
	id 1Z16eM-0002U4-57
	for gclcip-std-proposals@m.gmane.org; Sat, 06 Jun 2015 07:28:06 +0200
Original-Received: by pacso2 with SMTP id so2sf171610631pac.2
        for <gclcip-std-proposals@m.gmane.org>; Fri, 05 Jun 2015 22:28:04 -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:x-spam-checked-in-group
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=ak9c4Yd/hyinFulaw5Jbd2djb267tvdAfiem9bN7naA=;
        b=BFXk0fCrjRQxXksGVXeWNwrb48U1hhs9aRlqWU3iUwnrpfKGeFy1VNfRKgMG0U26xw
         FBBWhsNuVvQh9b5DLv1kMK04dQw2T5mA+6tks5BBcur74hbsX76Hd73tl2lj2wk78jgp
         +cpgCdSkLp6teZFxKT+OfF9KCmxq2hnF/yFvuBiUaFgGT42/kqBR+2HilIqEqT1sSNIv
         efgUsoc+W56F31/bw4rGGju1n/ntVTQYZr00f6Ac76XMovzE5SspmoGnP8BkKfreY5IQ
         q6xJJ57jLv2wHMYfvD2Fp2YjTPEUEhzGF5Rzy72IigdER/u86DjHiazdlthRzBWZeZ7v
         4Myg==
X-Gm-Message-State: ALoCoQnNcHmahaX2nJUyhaXQdT9mSGZCszkrVu8+5WbK68NvPFRe96ESWcfjn0D5idjt6oM2Rq0G
X-Received: by 10.70.54.130 with SMTP id j2mr8560635pdp.14.1433568484745;
        Fri, 05 Jun 2015 22:28:04 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.122.67 with SMTP id lq3ls754109igb.17.canary; Fri, 05 Jun
 2015 22:28:04 -0700 (PDT)
X-Received: by 10.50.13.9 with SMTP id d9mr25346igc.9.1433568483985;
        Fri, 05 Jun 2015 22:28:03 -0700 (PDT)
In-Reply-To: <19736033-58d4-441d-ae73-19804f8ef575@isocpp.org>
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-Spam-Checked-In-Group: 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:18437
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/18437>

------=_Part_246_19031279.1433568483196
Content-Type: multipart/alternative; 
	boundary="----=_Part_247_2031126397.1433568483196"

------=_Part_247_2031126397.1433568483196
Content-Type: text/plain; charset=UTF-8



On Saturday, June 6, 2015 at 12:14:16 PM UTC+7, german...@hubblehome.com 
wrote:
>
> Hello everyone,
>
> I would like to know if there would be interest in a proposal for 
> detecting when a string allocates in the heap.
>
> The rationale for this is that there are environments in which heap 
> allocations should be forbidden,
> but use of short strings can still be made, with the convenience of string 
> functions. 
> Embedded environments are such an example:
>
>
> A static member function (or free?) could be provided. Something like:
>
> //Pseudo-C++, no basic_string here to go straight to the question
> class string {
>    public:
>        static std::size_t max_stack_allocated_size();
>        static bool needs_dynamic_allocation(std::size_t sz);
> };
>
> I forgot constexpr:

//Pseudo-C++, no basic_string here to go straight to the question
class string {
   public:
       static constexpr std::size_t max_stack_allocated_size();
       static constexpr bool needs_dynamic_allocation(std::size_t sz);
};

-- 

--- 
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/.

------=_Part_247_2031126397.1433568483196
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:14:16 PM UTC+7, ge=
rman...@hubblehome.com wrote:<blockquote class=3D"gmail_quote" style=3D"mar=
gin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><=
div dir=3D"ltr">Hello everyone,<div><br></div><div>I would like to know if =
there would be interest in a proposal for detecting when a string allocates=
 in the heap.</div><div><br></div><div>The rationale for this is that there=
 are environments in which heap allocations should be forbidden,</div><div>=
but use of short strings can still be made, with the convenience of string =
functions.&nbsp;</div><div>Embedded environments are such an example:</div>=
<div><br></div><div><br></div><div>A static member function (or free?) coul=
d be provided. Something like:</div><div><br></div><div>//Pseudo-C++, no ba=
sic_string here to go straight to the question</div><div>class string {</di=
v><div>&nbsp; &nbsp;public:</div><div>&nbsp; &nbsp; &nbsp; &nbsp;static std=
::size_t max_stack_allocated_size();</div><div>&nbsp; &nbsp; &nbsp; &nbsp;s=
tatic bool needs_dynamic_allocation(std::<wbr>size_t sz);</div><div>};</div=
><div><br></div></div></blockquote><div>I forgot constexpr:</div><div><br><=
/div><div><div>//Pseudo-C++, no basic_string here to go straight to the que=
stion</div><div>class string {</div><div>&nbsp; &nbsp;public:</div><div>&nb=
sp; &nbsp; &nbsp; &nbsp;static constexpr std::size_t max_stack_allocated_si=
ze();</div><div>&nbsp; &nbsp; &nbsp; &nbsp;static constexpr bool needs_dyna=
mic_allocation(std::<wbr>size_t sz);</div><div>};</div></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_247_2031126397.1433568483196--
------=_Part_246_19031279.1433568483196--

.
