220 32379 <5f24e72e-6f21-4b99-84d7-053c940e66a1@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Jakob Riedle <jakob.riedle@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: =?UTF-8?B?UmU6IFtzdGQtcHJvcG9zYWxzXSBSZTogQWRkaW5nIHRoZSBLZXl3b3JkIOKAnGludGVyZg==?=
	=?UTF-8?B?YWNl4oCdIGluIEMrKw==?=
Date: Wed, 10 May 2017 00:25:57 -0700 (PDT)
Lines: 177
Approved: news@gmane.org
Message-ID: <5f24e72e-6f21-4b99-84d7-053c940e66a1@isocpp.org>
References: <c8742174-fef0-44a9-988d-2c8aebba9243@isocpp.org>
 <CACL3gUXPSVdsT0Z77igxGVtHU9ALGPcN=7hwKKKfBmt8eQmXtA@mail.gmail.com>
 <9ee212eb-4037-40c4-94c3-57a9a170a4c3@isocpp.org>
 <1765502.4y06pMOS3s@tjmaciei-mobl1>
 <e8fb03f4-8c94-46c2-a612-acab81117998@isocpp.org>
 <20170509050057.GA1227@noemi>
 <6edad2ff-ea7e-4b26-bf65-0311e63e7633@isocpp.org>
 <db7aa7af-ac88-4ba7-a5f7-94aaf9b7ebfd@isocpp.org>
 <31ce0dab-a80e-4356-a63c-a51ffb56b168@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_4694_615182131.1494401157979"
X-Trace: blaine.gmane.org 1494401160 30287 195.159.176.226 (10 May 2017 07:26:00 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 10 May 2017 07:26:00 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCX2XNFO6MPRBB4BZPEAKGQEORQDIVI@isocpp.org Wed May 10 09:25:56 2017
Return-path: <std-proposals+bncBCX2XNFO6MPRBB4BZPEAKGQEORQDIVI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f71.google.com ([209.85.218.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCX2XNFO6MPRBB4BZPEAKGQEORQDIVI@isocpp.org>)
	id 1d8M0R-0007ky-B2
	for gclcip-std-proposals@m.gmane.org; Wed, 10 May 2017 09:25:55 +0200
Original-Received: by mail-oi0-f71.google.com with SMTP id c132sf24698299oia.6
        for <gclcip-std-proposals@m.gmane.org>; Wed, 10 May 2017 00:26:01 -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=eOkJhDPDCAAXOdkAl7yi5I1KOrdSFTWOKAyUI9Kivgw=;
        b=TsLiazr8eTXeFOQbUIcvqYZZ09OXnuNpLtAg3p4ZlvBq4oD9ObI4tS3m1RqiZMexSS
         nqKW/G6lqjVnnO4JEAAgp+138RUQj2/LSTZiimuvFIahJpfWFiomHUC00Gr506Dsc7wn
         3WJ2BykUQ7d0QlkxHU23/cjwk3y3y928hX5hyAHi3yCWRPgXJbjjMbcQvl03AqNhq2YN
         7LTu+vws1lnTjIEg+l8lei+CWGiqdUm6kbl/e2aB0G3l7x7y/YqxHrzyqx6gKhshUdOG
         SvFgwTtOdxR/n4EC9Jl8/T/4fCtLSbJ3zdS7um67IKNSTxtprNFM0RBuetOL2Q8kwgKm
         3olA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        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=eOkJhDPDCAAXOdkAl7yi5I1KOrdSFTWOKAyUI9Kivgw=;
        b=M2k/a8OrWKMYU3FuyZ1JpIepvmcuv8ikxN1ENkhjEVsyZjkE446oVWwamdFzXrXNIg
         8XfaURNHj7P2S7a1ju4453L0h86lYORfQ99OZselew7rpYasIqwiafXhKzBMRyRr034y
         EusmCPXlSFiX005XmfbA50+TwRT1OSituLS8TKZ5B8Qte3R+L/VUMfgVkGDQhNeLD/QY
         3m+YZQZ6AyNDJoyMZFFvO1u2D5MIQChcey4WALf/tCYqNg6ox4/h9X3dJ/RpvyLv9hsU
         R07w+qMfuRvMnY3FgOJCiWVHj+bD+9RVo6gy5JwTMADlZIb6ykkw3GvBAwh5gC30WBZe
         01QQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        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=eOkJhDPDCAAXOdkAl7yi5I1KOrdSFTWOKAyUI9Kivgw=;
        b=T+jZHN+T/OD8hft/rpDr2S6GHZ7zrJsejWMkGD6+gjZDrGExFSr+OJ2qKOEHfV7Zc8
         /R6z7oLH35ifXNdkpcXsAuoXsxqpskHpMfuKOk1mmB0g/alXVq7jbv3ytgyfUlcvW0jA
         G6eyvPlqRgIMAT0L9Sa4s8irqViZxAFCY5l+vDk+0NI6Ibhet7uiWfLfcV+5eDnzkb98
         IzaoQb/PzM7k7xlbLuqAW38W343iXe0hWTg7jUYhULOlEucQ6wgnQhXqqxxmIXWRccOj
         8dp5oJN4DO7INYqEBbZ2cYiK3JtWRoiDUrhuuW57D7AFheGSpc6le/I0Kcs9qFmzp7S3
         Z5mA==
X-Gm-Message-State: AODbwcA+NvygrT2MJg+Oab+6cPyAdgwxnm5Pr1KZyCKbXWEa5u3GgG/8
	QqDL2WF4s6lqaQ==
X-Received: by 10.157.45.50 with SMTP id v47mr2101728ota.105.1494401160545;
        Wed, 10 May 2017 00:26:00 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.23.8 with SMTP id i8ls2167009ota.11.gmail; Wed, 10 May
 2017 00:25:58 -0700 (PDT)
X-Received: by 10.157.35.104 with SMTP id k37mr89639otd.14.1494401158752;
        Wed, 10 May 2017 00:25:58 -0700 (PDT)
In-Reply-To: <31ce0dab-a80e-4356-a63c-a51ffb56b168@isocpp.org>
X-Original-Sender: jakob.riedle@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: <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:32379
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32379>

------=_Part_4694_615182131.1494401157979
Content-Type: multipart/alternative; 
	boundary="----=_Part_4695_1471380589.1494401157980"

------=_Part_4695_1471380589.1494401157980
Content-Type: text/plain; charset="UTF-8"


>
> I was thinking about the same issue before posting this solution, because 
> the "interfaces" seems to have violated the "single responsibility 
> principle". Thus, the conversion is only allowed when the concrete 
> implementations are passed "by value" (as a copy), whose ownership/lifetime 
> shall be managed within the "interface" system.
> Thank you!


Oh, that is so true, I didn't realize that before!

So what be basically want is this?
std::function<void()> f1 = /**/;
std::function<void()> f2();
const volatile std::function<void()> f3 = /**/;

Callable<void()> c1 = f1; // This copies f. Internally, an std::unique_ptr 
as handle is needed.
Callable<void()>& c2 = f1; // This references f. internally, the abstract 
class generatedfor Callable needs a '&' handle.
Callable<void()>&& c3 = f2(); // Internally uses '&&' as handle.
const volatile Callable<void()>& c4 = f3; //Internally 'const &' as handle.
// and so on...

At least now, Dynamic Concepts need to be a language feature, since the 
reference/const/volatile specification needs to be internalized into the 
implicit abstract class generation.
 
Cheers,
Jakob

@Minxing Wang: Could you please not cite whole posts in your answers, this 
elongates the thread immensely :)

-- 
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/5f24e72e-6f21-4b99-84d7-053c940e66a1%40isocpp.org.

------=_Part_4695_1471380589.1494401157980
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">=
<font face=3D"georgia, serif">I was thinking about the same issue before po=
sting this solution, because the &quot;interfaces&quot; seems to have viola=
ted the &quot;single responsibility principle&quot;. Thus, the conversion i=
s only allowed when the concrete implementations are passed &quot;by value&=
quot; (as a copy), whose ownership/lifetime shall be managed within the &qu=
ot;interface&quot; system.</font><font face=3D"georgia, serif"><br></font><=
font face=3D"georgia, serif">Thank you!</font></blockquote><div><br></div><=
div>Oh, that is so true, I didn&#39;t realize that before!</div><div><br></=
div><div>So what be basically want is this?</div><div><div class=3D"prettyp=
rint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187,=
 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"=
><code class=3D"prettyprint"><div class=3D"prettyprint" style=3D"background=
-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style:=
 solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettypri=
nt"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">::</span><span style=3D"color: #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;" class=3D"styled-by-prettify">()&gt;</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> f1 </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">/**/</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>std</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">::</span><span style=3D"color: #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-prett=
ify">void</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
)&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> f2</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">const</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">volatile</span><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"color: #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"st=
yled-by-prettify">void</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">()&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> f3 </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #800;" class=3D"styled-by-prettify">/**/</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Callable</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">()&gt;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> c1 </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> f1</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">// This=
 copies f. Internally, an std::unique_ptr as handle is needed.</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Callable</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">()&gt;&amp;</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> c2 </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> f1</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">/=
/ This references f. internally, the abstract class generatedfor Callable n=
eeds a &#39;&amp;&#39; handle.</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span><span style=3D"color: #606;" class=3D"styled=
-by-prettify">Callable</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">void</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
()&gt;&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> c3 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> f2</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">();</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">// Internally uses &#39;&amp=
;&amp;&#39; as handle.</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">const</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">volatile=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">Callable</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">()&gt;&amp;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> c4 </span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> f3</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pret=
tify">//Internally &#39;const &amp;&#39; as handle.</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
800;" class=3D"styled-by-prettify">// and so on...</span></div></code></div=
></code></div><div><br></div>At least now, Dynamic Concepts need to be a la=
nguage feature, since the reference/const/volatile specification needs to b=
e internalized into the implicit abstract class generation.</div><div>=C2=
=A0</div><div>Cheers,</div><div>Jakob</div><div><br></div><div>@Minxing Wan=
g: Could you please not cite whole posts in your answers, this elongates th=
e thread immensely :)</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/5f24e72e-6f21-4b99-84d7-053c940e66a1%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5f24e72e-6f21-4b99-84d7-053c940e66a1=
%40isocpp.org</a>.<br />

------=_Part_4695_1471380589.1494401157980--

------=_Part_4694_615182131.1494401157979--

.
