220 26934 <9925907.dlQ8qs8rgK@tjmaciei-mobl1> article
Path: news.gmane.org!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Proposal - non allocating std::function
Date: Wed, 13 Jul 2016 17:20:34 -0700
Lines: 38
Approved: news@gmane.org
Message-ID: <9925907.dlQ8qs8rgK@tjmaciei-mobl1>
References: <e00db911-40f5-4c11-a4b8-32bba77aa0a5@isocpp.org> <4948193.1toAHviMXG@tjmaciei-mobl1> <CAFk2RUaOii3qgGA7jDZJV6oE-3eoDAQKhmrO8DpUbB3ZVDF6Qg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1468455649 21325 80.91.229.3 (14 Jul 2016 00:20:49 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 14 Jul 2016 00:20:49 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBVFVTO6AKGQEX3E4JLI@isocpp.org Thu Jul 14 02:20:41 2016
Return-path: <std-proposals+bncBCB4TK757YBRBVFVTO6AKGQEX3E4JLI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f69.google.com ([209.85.215.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCB4TK757YBRBVFVTO6AKGQEX3E4JLI@isocpp.org>)
	id 1bNUOL-0001US-Ti
	for gclcip-std-proposals@m.gmane.org; Thu, 14 Jul 2016 02:20:37 +0200
Original-Received: by mail-lf0-f69.google.com with SMTP id l89sf42461286lfi.3
        for <gclcip-std-proposals@m.gmane.org>; Wed, 13 Jul 2016 17:20:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=from:to:subject:date:message-id:user-agent:in-reply-to:references
         :mime-version:content-transfer-encoding:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=A3PZXQ6QNFaN1i0esZanZG1Se337UWN4KjxDWE9m48g=;
        b=Mla7wrkO61YKE88eQmdzdbbGxGbfJgKWYRH06Q8qNfSAN/2q1rfGfkeUQ3EWnw7+AF
         wfqXFK8q0/lod2//BnuNUiWnY/JyR5tXfsCtsogHeXxMyoUeIozo9TNduEmDa0rzqFRa
         n4F+kVwHcM+Yr1dsn54eLB+KfHK986RxCX8COUF3BarnEXmyIIwjzx6J2hrkD4b9RjQE
         krW3LzNCj6Tsf79MAJWqXBAqJjObDpYdt+J1bK9E3k6nukR2n78Opu8Ht+CUyCG/YhPc
         QufGU3DPDGqwyJdMSUn6bXl0kmzEPhZcCkFKcfzMQQtEYlcIKlSQTrBVIFitkeHV/Q/D
      
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:to:subject:date:message-id:user-agent
         :in-reply-to:references:mime-version:content-transfer-encoding
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=A3PZXQ6QNFaN1i0esZanZG1Se337UWN4KjxDWE9m48g=;
        b=IXWWXmko9cnXLrO7UjP9BW3pzB7VhtSskH5g76gKRnRjhYNMcFX9lNkux+N/PB8Nku
         eSzZHlNms+pDBE8qlBh3tudnKv51W0i3cg0HCoe8p3ukl7ee7NikNal6fxXTuQvAlFk6
         mC20frY0HY3SYIURV3ysstVmr8R5GPFmINGyRYqNMo/ltG+5l6AuWs7DmaG7+P24lHJv
         bOBbImJDwnJCKKIwbAhEKXRT4UFAJ6IY2OHmksc3XoNyBWN52hxSCEOqE0O3BodeTNfC
         p2x1HnL0xDnuITXUhfpUt75Fni+qUQToW6QEJxwUO6Lbp7U1JSng22/quYhPSsCbxtmU
  
X-Gm-Message-State: ALyK8tLzlF8Rdj7V+YzLE/mGne1CpiojnbyeDH+8Tpxrq2IdZNMtjS+avQjMZt7UV7pHYg==
X-Received: by 10.28.203.3 with SMTP id b3mr1934261wmg.1.1468455637361;
        Wed, 13 Jul 2016 17:20:37 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.27.209 with SMTP id b200ls79040wmb.23.gmail; Wed, 13 Jul
 2016 17:20:36 -0700 (PDT)
X-Received: by 10.28.27.211 with SMTP id b202mr1654728wmb.12.1468455636328;
        Wed, 13 Jul 2016 17:20:36 -0700 (PDT)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [78.47.120.188])
        by mx.google.com with ESMTP id a62si30393485wmc.78.2016.07.13.17.20.36
        for <std-proposals@isocpp.org>;
        Wed, 13 Jul 2016 17:20:36 -0700 (PDT)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) client-ip=78.47.120.188;
Original-Received: from tjmaciei-mobl1.localnet (unknown [134.134.139.77])
	by gondolin.macieira.info (Postfix) with ESMTPSA id EC18C11A776
	for <std-proposals@isocpp.org>; Wed, 13 Jul 2016 17:20:35 -0700 (PDT)
User-Agent: KMail/5.2.2 (Linux/4.6.3-1-default; KDE/5.23.0; x86_64; ; )
In-Reply-To: <CAFk2RUaOii3qgGA7jDZJV6oE-3eoDAQKhmrO8DpUbB3ZVDF6Qg@mail.gmail.com>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mailfrom=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-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:26934
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/26934>

Em quinta-feira, 14 de julho de 2016, =C3=A0s 02:26:17 PDT, Ville Voutilain=
en=20
escreveu:
> > Hi Carl
> >=20
> > Can you explain somewhere why std::function is unable to do that?
> >=20
> > In other words, why must std::function allocate memory?
>=20
> Because it does type erasure and can hold a functor of any size, and
> can be assigned to from another functor
> of any size. Presumably this new type would fail to initialize if a
> functor larger than the internal buffer is used
> for initialization or assignment.

Ah, I see: functors (incl. lambdas). I was thinking of function pointers an=
d=20
PMFs. Functors can have an arbitrary size, so no std::function implementati=
on=20
can be wide enough to hold all possibilities.

But as a matter of QoI, std::function should not allocate for regular funct=
ion=20
pointers and PMFs, plus stateless functors & lambdas.

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/9925907.dlQ8qs8rgK%40tjmaciei-mobl1.

.
