220 29996 <25614213-fc89-43e3-a17d-228fe01a9d01@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: curious <aary@umich.edu>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Return type deduction into a template parameter
Date: Fri, 23 Dec 2016 21:27:11 -0800 (PST)
Lines: 106
Approved: news@gmane.org
Message-ID: <25614213-fc89-43e3-a17d-228fe01a9d01@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_995_1486324719.1482557231300"
X-Trace: blaine.gmane.org 1482557238 22487 195.159.176.226 (24 Dec 2016 05:27:18 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 24 Dec 2016 05:27:18 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCB57BFXS4MRBMEO7DBAKGQEZAKKXKQ@isocpp.org Sat Dec 24 06:27:14 2016
Return-path: <std-proposals+bncBCB57BFXS4MRBMEO7DBAKGQEZAKKXKQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f197.google.com ([209.85.217.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCB57BFXS4MRBMEO7DBAKGQEZAKKXKQ@isocpp.org>)
	id 1cKerM-0004Gg-1N
	for gclcip-std-proposals@m.gmane.org; Sat, 24 Dec 2016 06:27:08 +0100
Original-Received: by mail-ua0-f197.google.com with SMTP id 96sf39265826uaq.7
        for <gclcip-std-proposals@m.gmane.org>; Fri, 23 Dec 2016 21:27:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id: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=xp4c0WwxMmqwx3VD52fnMyKio3Vz37+VIZWLicjghdI=;
        b=klUVpgqhBH97y32LzIgijokHEpZ27I5m7cXyCfzHkryB3SuN8mV1uIvU442lYGYa47
         jwvbQBkI2Ni1/Q5jOPpzMs+Y2mgyoSNmVnVY4U66ywBNOPSRaxMHp731B+ipTLR4hEtD
         L9BlCUd//oVyV8P672jOy5KLkOlTHnELlsZPq+Rs+Oz6tYLKsDi8hyGJ++USeGV3me3O
         cJsdUs7a3aeIIs4fw85sG3nZHe1qC7j8LsAPDmLqFPU/OM7Ux2CkHn5JOvGRAiwErzF0
         2DW+PMBs7BN+UsPesK15bAXYczGXm3hk4HbAw21LSnwEGWWaOPa3Q/iXqaePew/pcbl4
         awog==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=umich.edu; s=google-2016-06-03;
        h=date:from:to:message-id: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=xp4c0WwxMmqwx3VD52fnMyKio3Vz37+VIZWLicjghdI=;
        b=Y9H2diPVSds3WNf6GovVbgMG01LWeyuFnbGV9Or8gQY/ylOq7MygsUdfSEJ28jlx6/
         yjtksRRpMdDkYlNVGg6fGk41bEWFpfzgSOYS1lX++7kWJOCTAu/46Q6Mm9N117uzw2ez
         sa9JbR0Tc+1AUB1j5Jx4v/Sx/QvX2+iy4amtCqySy/wHqPXe1PZsoTdCZhRecsTkw1uJ
         0bJm2iEVh3aWxPr+0Izvfmiv2pxt/81iF4QnMSpbPBwFFQoDBdCjWOgyQX00t3c4ICdC
         gZCWRRs8ekkZ801D8fvsRiAmCJysjKt8Fz8lquTh3dzkZY700H56ort259p3sryrB+LS
         RZNw==
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: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=xp4c0WwxMmqwx3VD52fnMyKio3Vz37+VIZWLicjghdI=;
        b=TLGUrZ66AcKpIggYo47+MkoGmzxOUb5u6z1BqEazK+l/ZJelvMABaX1p9lL9dTe6il
         RwbYxmxgGmg24im2S/jaidv3U/G1VKXfWlGh9VcayTMrimAcChlCFgwHsbpvzSM1iyCo
         Wt3A3Zle/su7Hx8w7Xi/rCNR4yQyF2dPBvatQXeFBihSFcomN9qFLknsBlnEYrF+R/Ls
         vqFx/EdcQMP6Oy9zjGWmzvYi0Jv6suiT1ToBKv7AHu3deCNyAtwvlVac7YMHUgQCJpNL
         T9QNl9NVaIwsPHZ1FxMKtCNoxZ7ndVyL9PvcBk4T45g57cVq3SZOGC8XGlGSarcom3y2
         YQgw==
X-Gm-Message-State: AIkVDXINhPFgX0vdcVaMmwBGiastKpJvClkHSxIDmNoH9do76G7lOYnSpY2PM/y5SUjXzA==
X-Received: by 10.159.48.30 with SMTP id h30mr8287453uab.6.1482557232579;
        Fri, 23 Dec 2016 21:27:12 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.63.53 with SMTP id m50ls27481772otc.10.gmail; Fri, 23 Dec
 2016 21:27:11 -0800 (PST)
X-Received: by 10.157.20.197 with SMTP id r5mr1322851otr.9.1482557231911;
        Fri, 23 Dec 2016 21:27:11 -0800 (PST)
X-Original-Sender: aary@umich.edu
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:29996
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29996>

------=_Part_995_1486324719.1482557231300
Content-Type: multipart/alternative; 
	boundary="----=_Part_996_1759476799.1482557231301"

------=_Part_996_1759476799.1482557231301
Content-Type: text/plain; charset=UTF-8

Hey guys,

The proposal here is to allow the return type deduction syntax to be 
extendible to more versatile situations for example as a template 
parameter.  Consider the following code

template <typename Something>
auto return_something(const Something& something);

This interface gives the reader little to no information about what 
actually is being returned from the function, they have no way of knowing 
how they should go about interacting with the returned object.  If instead 
something like the following could be done

// in the .hpp file, this is the declaration of the function, exposing 
useful
// information to the user about the return type of the function, they now
// know that they can interact with the return type every way that the
// SomeInterfaceOrConcept class can be used.  
template <typename Something>
SomeInterfaceOrConcept<auto> return_something(const Something& something);

Now the reader instantly knows that the return type is an instantiation of 
the SomeInterfaceOrConcept class, and this function has therefore been 
documented well without requiring the reader to look into the 
implementation of the function or look at a trailing return type, which can 
sometimes be just as complicated as looking at the actual function body 
itself.  Further sometimes it is convenient to skip the trailing return 
type entirely.  

Another thing this enables is the ability to add concept checks to the 
return type.  Giving the reader a better idea of the value being returned 
without knowing its actual concrete type.  

-- 
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/25614213-fc89-43e3-a17d-228fe01a9d01%40isocpp.org.

------=_Part_996_1759476799.1482557231301
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hey guys,<div><br></div><div>The proposal here is to allow=
 the return type deduction syntax to be extendible to more versatile situat=
ions for example as a template parameter. =C2=A0Consider the following code=
</div><div><br></div><div><font face=3D"courier new, monospace">template &l=
t;typename Something&gt;</font></div><div><font face=3D"courier new, monosp=
ace">auto return_something(const Something&amp; something);</font></div><di=
v><font face=3D"courier new, monospace"><br></font></div><div><font face=3D=
"arial, sans-serif">This interface gives the reader little to no informatio=
n about what actually is being returned from the function, they have no way=
 of knowing how they should go about interacting with the returned object. =
=C2=A0If instead something like the following could be done</font></div><di=
v><font face=3D"arial, sans-serif"><br></font></div><div><div><font face=3D=
"courier new, monospace">// in the .hpp file, this is the declaration of th=
e function, exposing useful<br></font></div><div><font face=3D"courier new,=
 monospace">// information to the user about the return type of the functio=
n, they now</font></div><div><font face=3D"courier new, monospace">// know =
that they can interact with the return type every way that the</font></div>=
<div><font face=3D"courier new, monospace">// SomeInterfaceOrConcept class =
can be used. =C2=A0</font></div><div><font face=3D"courier new, monospace">=
template &lt;typename Something&gt;</font></div><div><font face=3D"courier =
new, monospace">SomeInterfaceOrConcept&lt;auto&gt; return_something(const S=
omething&amp; something);</font></div><div><br></div></div><div><font face=
=3D"arial, sans-serif">Now the reader instantly knows that the return type =
is an instantiation of the </font><font face=3D"courier new, monospace">Som=
eInterfaceOrConcept</font><font face=3D"arial, sans-serif"> class, and this=
 function has therefore been documented well without requiring the reader t=
o look into the implementation of the function or look at a trailing return=
 type, which can sometimes be just as complicated as looking at the actual =
function body itself. =C2=A0Further sometimes it is convenient to skip the =
trailing return type entirely. =C2=A0</font></div><div><font face=3D"arial,=
 sans-serif"><br></font></div><div><font face=3D"arial, sans-serif">Another=
 thing this enables is the ability to add concept checks to the return type=
.. =C2=A0Giving the reader a better idea of the value being returned without=
 knowing its actual concrete type. =C2=A0</font></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/25614213-fc89-43e3-a17d-228fe01a9d01%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/25614213-fc89-43e3-a17d-228fe01a9d01=
%40isocpp.org</a>.<br />

------=_Part_996_1759476799.1482557231301--

------=_Part_995_1486324719.1482557231300--

.
