220 26942 <b8ca2bb9-2446-4640-8c40-df6566473f0b@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Proposal - non allocating std::function
Date: Wed, 13 Jul 2016 19:15:40 -0700 (PDT)
Lines: 102
Approved: news@gmane.org
Message-ID: <b8ca2bb9-2446-4640-8c40-df6566473f0b@isocpp.org>
References: <D. B.'s message of "Thu\, 14 Jul 2016 00\:26\:31 +0100 \(12 minutes\,
	3 seconds ago\)">
 <871t2xqbb5.fsf@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_76_678687218.1468462540724"
X-Trace: ger.gmane.org 1468462545 29190 80.91.229.3 (14 Jul 2016 02:15:45 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 14 Jul 2016 02:15:45 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBTPLTO6AKGQETE4B4EA@isocpp.org Thu Jul 14 04:15:45 2016
Return-path: <std-proposals+bncBCEKFTV6ZUMBBTPLTO6AKGQETE4B4EA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f70.google.com ([209.85.214.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBTPLTO6AKGQETE4B4EA@isocpp.org>)
	id 1bNWBj-0006Je-Lq
	for gclcip-std-proposals@m.gmane.org; Thu, 14 Jul 2016 04:15:43 +0200
Original-Received: by mail-it0-f70.google.com with SMTP id g8sf128511967itb.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 13 Jul 2016 19:15:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :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=eLZcFfmzv2shG+g7R0yx+x3HHR1tdZMpjqrMsG0C9FE=;
        b=BZwqU12M89n92e+VRLVK1k40rUOWmqlJlpF5p6pOkg5JdJXKkUT9HRER6rYmTwrsuO
         kUm5qaH72XUiblFQFpwmgy+/BzJCZV5zIjqRw060PYR/57LUfiLYl6BEtHDv/w5nJP8m
         B8XqwCu0EdSP9Ys4U2XGBoboqfumdPuweutv2aATSb8hqhjbbinflXf1QrkGXo4q7wEW
         FTNHb+4uwE1yFbmCwQGDNTIDFs9LP+SEzZLFWCyursV/y5KHa5zyifg5WrYOcUacS/Oy
         I4ix9INFlPGrmyUiS82xFYpEbZNqaGru4jdqhgib65xCf0me55NGtRKy9GOSIZpUTYop
         qJSA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :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=eLZcFfmzv2shG+g7R0yx+x3HHR1tdZMpjqrMsG0C9FE=;
        b=sVIxboI/0XlOqs6homYDldMHpPsYj1RA/ML3NVNUr3Ob5oAUuCeffz9G7QzOU/bQUO
         zsVhzil/jmodi0Dxgox3Sp1wV9/H5r9mhhbuvtm9r+T2MxpHC/ZJX1ejWG+Km87m8JYa
         EATQ90KOSvML65RGmZvvELla7mgW3N1YUx9Dam9Tv3rwa+h4rJumpXZv9Hb7XBLZeduV
         ajJDN5P/3fCJ3Kuw09qS9OFHKExs915NZp1GTJlgjWde9gicX1HS7mE7OIKIWBgNdc/7
         uLkOIMG2QJj2hcN2nV+U8N7vfmlRfQhKZjiX6H09vz3HXYd7WTJ73P9tZDADEvz6tbkn
         dKIA==
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:message-id:in-reply-to:references
         :subject:mime-version: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=eLZcFfmzv2shG+g7R0yx+x3HHR1tdZMpjqrMsG0C9FE=;
        b=j2qjPCXcjkB8JGTgwBGpj+4EjsjxEbg4TNhwMvtjSXwzXADlAzxY5rs9HoihIxVSDQ
         sMI+30JNcok4soojaxdhu6V/mfcCx55wWg64qHG/IeenEnUQgYK/NsZRfit6wfby5ZBx
         R5ql9KcD2kBwuIs3HP8MJZWCj0ONOHTHLubbLGmgAD21r4nnAdKbOzc6j1Q/ramvtm3j
         qPsTiBZ5dvyCAL21+mQB3W1meqqk2G7br9U5R78FxIT32SEUiV85btcAqhMQjSur+KwI
         J63QTG2Z4KCOEzW8K1StyWQPb0ckFhbE5IWVqf8JrQ6QyDuoePm0s0UPLJyDvTy3UBKm
         JI3A==
X-Gm-Message-State: ALyK8tKeMNYioR3F14ei5XSJMHLSigeaMpYuNlufmnshMCLG7WDPodWec8JK0Ru1+784CQ==
X-Received: by 10.107.34.7 with SMTP id i7mr9277546ioi.17.1468462542784;
        Wed, 13 Jul 2016 19:15:42 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.32.205 with SMTP id g196ls232277iog.51.gmail; Wed, 13 Jul
 2016 19:15:41 -0700 (PDT)
X-Received: by 10.36.50.75 with SMTP id j72mr835318ita.5.1468462541756;
        Wed, 13 Jul 2016 19:15:41 -0700 (PDT)
In-Reply-To: <871t2xqbb5.fsf@gmail.com>
X-Original-Sender: jmckesson@gmail.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: <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:26942
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26942>

------=_Part_76_678687218.1468462540724
Content-Type: multipart/alternative; 
	boundary="----=_Part_77_800067329.1468462540724"

------=_Part_77_800067329.1468462540724
Content-Type: text/plain; charset=UTF-8

On Wednesday, July 13, 2016 at 9:05:06 PM UTC-4, Moritz Klammler wrote:
>
> > Very briefly, some of us are interested in having a standardized 
> > function which does not incur an upfront memory allocation to store 
> > the callable target, instead opting for a compile time specified 
> > buffer (stack allocated). This has been quite useful in several low 
> > latency domains such as gaming and electronic trading. In other words, 
> > a drop-in replacement for std::function, where all data is on the 
> > stack. 
>
> Isn't this already possible by using today's `std::function` with a 
> custom allocator backed by a stack-based array?


I'm not clear as to what you mean here. Consider this:

std::function<void()> a_func()
{
  return []{};
}

What would the "stack-based array" equivalent look like? Would it look as 
reasonable as this? Would it be able to use that nifty guaranteed elision 
stuff we'll be getting?

-- 
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/b8ca2bb9-2446-4640-8c40-df6566473f0b%40isocpp.org.

------=_Part_77_800067329.1468462540724
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, July 13, 2016 at 9:05:06 PM UTC-4, Moritz Kl=
ammler wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">&gt; Very briefly=
, some of us are interested in having a standardized
<br>&gt; function which does not incur an upfront memory allocation to stor=
e
<br>&gt; the callable target, instead opting for a compile time specified
<br>&gt; buffer (stack allocated). This has been quite useful in several lo=
w
<br>&gt; latency domains such as gaming and electronic trading. In other wo=
rds,
<br>&gt; a drop-in replacement for std::function, where all data is on the
<br>&gt; stack.
<br>
<br>Isn&#39;t this already possible by using today&#39;s `std::function` wi=
th a
<br>custom allocator backed by a stack-based array?</blockquote><div><br>I&=
#39;m not clear as to what you mean here. Consider this:<br><br><div class=
=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-colo=
r: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: b=
reak-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">function</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">void</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">()&gt;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> a_func</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">()</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">ret=
urn</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">[]{};</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></code></div>=
<br>What would the &quot;stack-based array&quot; equivalent look like? Woul=
d it look as reasonable as this? Would it be able to use that nifty guarant=
eed elision stuff we&#39;ll be getting?<br></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/b8ca2bb9-2446-4640-8c40-df6566473f0b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b8ca2bb9-2446-4640-8c40-df6566473f0b=
%40isocpp.org</a>.<br />

------=_Part_77_800067329.1468462540724--

------=_Part_76_678687218.1468462540724--

.
