220 9162 <CAN=4vMoTCgzffK1b5+GRfg2EU-FG_J_X=R8aMeEc7yqQm7-UBg@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Any plans for enabling the use of move-only
 objects in std::function?
Date: Thu, 6 Feb 2014 20:31:44 +0100
Lines: 85
Approved: news@gmane.org
Message-ID: <CAN=4vMoTCgzffK1b5+GRfg2EU-FG_J_X=R8aMeEc7yqQm7-UBg@mail.gmail.com>
References: <0532b9dd-9235-4871-b16c-656145bd0781@isocpp.org>
 <CANh-dX=D4Je7=pTwyDv2+MxQ=Sh5H_8ueU9tbKEiL18Gpi_W+Q@mail.gmail.com> <99dbf36e-4f1b-499b-bd17-8b7a9e056e28@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=089e012942329c881b04f1c1ed9c
X-Trace: ger.gmane.org 1391715119 1803 80.91.229.3 (6 Feb 2014 19:31:59 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 6 Feb 2014 19:31:59 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC55TTG52EFRBNOGZ6LQKGQEP3NAHFI@isocpp.org Thu Feb 06 20:32:07 2014
Return-path: <std-proposals+bncBC55TTG52EFRBNOGZ6LQKGQEP3NAHFI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yh0-f69.google.com ([209.85.213.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC55TTG52EFRBNOGZ6LQKGQEP3NAHFI@isocpp.org>)
	id 1WBUgA-0002iX-Ux
	for gclcip-std-proposals@m.gmane.org; Thu, 06 Feb 2014 20:32:07 +0100
Original-Received: by mail-yh0-f69.google.com with SMTP id a41sf5629480yho.4
        for <gclcip-std-proposals@m.gmane.org>; Thu, 06 Feb 2014 11:32:06 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to: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=ESnFf9QTzsBLebrtMKCSTqS1bHZzdv2LpeVabKAFYP4=;
        b=bir+4szhDyzJ4jLc3xv7KDjWK1B/qCLljWQempBMpdWxPrHh6R0DnuLwkYaDS3nbc2
         JvjRxjg8ncI46RAOqfMGpwS3W4fyQixK9MHdHxTMxQ/UOKMav6HKIKeU7NEsnnV3zuSZ
         8IJKOMsmFaIfucUZbAk+zZ8FYbYt+f3eXqm6WSl25c5MJhoIkuu8Yf+JMzPruec3wRxO
         GzFqC8B4szUDfhgM/xi7D3grQ3nnc2NitIXU2lDH4AN0F0VSRcNQ0ZH3wFQJZNikfQYf
         cBe/8gE3gSRmV/M7nMA3Tqs1sYQjFaO0OgUgMEiGiqcotqG6bY+kkf7MqRgCDZf02CWD
         8pqA==
X-Gm-Message-State: ALoCoQlxZCPaSHbSHIH4GUKrhkFUeMlGw5xdW+XlISOrwjZyd4iODxhVguVndCcJ09v83mye79g8
X-Received: by 10.58.120.76 with SMTP id la12mr2510844veb.21.1391715126135;
        Thu, 06 Feb 2014 11:32:06 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.24.215 with SMTP id 81ls713126qgr.14.gmail; Thu, 06 Feb
 2014 11:32:05 -0800 (PST)
X-Received: by 10.52.30.167 with SMTP id t7mr2136523vdh.36.1391715125418;
        Thu, 06 Feb 2014 11:32:05 -0800 (PST)
Original-Received: from mail-ve0-x234.google.com (mail-ve0-x234.google.com [2607:f8b0:400c:c01::234])
        by mx.google.com with ESMTPS id uh1si500014vcb.100.2014.02.06.11.32.04
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Thu, 06 Feb 2014 11:32:04 -0800 (PST)
Received-SPF: pass (google.com: domain of roman.perepelitsa@gmail.com designates 2607:f8b0:400c:c01::234 as permitted sender) client-ip=2607:f8b0:400c:c01::234;
Original-Received: by mail-ve0-f180.google.com with SMTP id db12so1925850veb.11
        for <std-proposals@isocpp.org>; Thu, 06 Feb 2014 11:32:04 -0800 (PST)
X-Received: by 10.58.54.15 with SMTP id f15mr6978808vep.5.1391715124281; Thu,
 06 Feb 2014 11:32:04 -0800 (PST)
Original-Received: by 10.58.179.40 with HTTP; Thu, 6 Feb 2014 11:31:44 -0800 (PST)
In-Reply-To: <99dbf36e-4f1b-499b-bd17-8b7a9e056e28@isocpp.org>
X-Original-Sender: roman.perepelitsa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of roman.perepelitsa@gmail.com designates 2607:f8b0:400c:c01::234 as
 permitted sender) smtp.mail=roman.perepelitsa@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=gmail.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: <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:9162
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/9162>

--089e012942329c881b04f1c1ed9c
Content-Type: text/plain; charset=ISO-8859-1

2014-02-06 Scott Prager <splinterofchaos@gmail.com>:

>
> On Thursday, February 6, 2014 1:33:26 PM UTC-5, Nevin ":-)" Liber wrote:
>
>> Or a throwing wrapper if an attempt is made to copy a move-only functor?
>>
>> Just adding to the design space,
>> --
>>  Nevin ":-)" Liber  <mailto:ne...@eviloverlord.com>  (847) 691-1404
>>
>
> Similarly, move_only_function?
>

That is my preferred solution and that's what I use in my code: I have
class template mfunction<F> which is exactly the same as std::function<F>
but not copyable (it's movable, though). By giving up the ability to copy
type erased functor you allow it to be constructed from non-copyable
function objects. That's a great trade off. I found the necessity to copy
std::function to be very rare, thus mfunction can be used in the vast
majority of interfaces.

Roman Perepelitsa.

-- 

--- 
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/.

--089e012942329c881b04f1c1ed9c
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">2014=
-02-06 Scott Prager <span dir=3D"ltr">&lt;<a href=3D"mailto:splinterofchaos=
@gmail.com" target=3D"_blank">splinterofchaos@gmail.com</a>&gt;</span>:<br>=
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">

<div dir=3D"ltr"><div class=3D"im"><br></div><div><div class=3D"im">On Thur=
sday, February 6, 2014 1:33:26 PM UTC-5, Nevin &quot;:-)&quot; Liber wrote:=
</div><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex=
;border-left:1px #ccc solid;padding-left:1ex">

<div dir=3D"ltr"><div><div class=3D"im"><div class=3D"gmail_quote"><div>Or =
a throwing wrapper if an attempt is made to copy a move-only functor?<br><b=
r></div><div>Just adding to the design space, <br></div></div>-- <br></div>

=A0Nevin &quot;:-)&quot; Liber=A0 &lt;mailto:<a>ne...@eviloverlord.com</a><=
u></u>&gt;=A0 (847) 691-1404
</div></div>
</blockquote><br>Similarly, move_only_function?<br></div></div></blockquote=
><div><br></div><div>That is my preferred solution and that&#39;s what I us=
e in my code: I have class template mfunction&lt;F&gt; which is exactly the=
 same as std::function&lt;F&gt; but not copyable (it&#39;s movable, though)=
.. By giving up the ability to copy type erased functor you allow it to be c=
onstructed from non-copyable function objects. That&#39;s a great trade off=
.. I found the necessity to copy std::function to be very rare, thus mfuncti=
on can be used in the vast majority of interfaces.</div>

<div><br></div><div>Roman Perepelitsa.</div></div></div></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />

--089e012942329c881b04f1c1ed9c--

.
