Topic: generic functions


Author: oliora@gmail.com
Date: Sun, 12 Jul 2015 23:58:45 -0700 (PDT)
Raw View
------=_Part_4723_694218915.1436770725782
Content-Type: text/plain; charset=UTF-8

Hello!

What do you think about applying generic lambda approach to standard function, like when you can use auto type for a standard function argument to indicate that this function is in fact a function template accepting any parameter type.
For example:
void foo(auto&& arg);
should mean the same as
template<class T>
void foo(T&& t);

I like to call it generic functions because they related to ordinal functions like generic lambdas to ordinal lambdas.

I understand that this is only a syntactic sugar (unlike with lambdas) but in times where functional and generic programming are so rising, it' important to have short way to define tamplate functions.


Any feedback is appreciated.

Thank you,
Andrey Upadyshev <oliora@gmail.com>

--

---
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/.

------=_Part_4723_694218915.1436770725782--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 13 Jul 2015 00:08:58 -0700
Raw View
On Sunday 12 July 2015 23:58:45 oliora@gmail.com wrote:
> Hello!
>
> What do you think about applying generic lambda approach to standard
> function, like when you can use auto type for a standard function argument
> to indicate that this function is in fact a function template accepting any
> parameter type. For example:
> void foo(auto&& arg);
> should mean the same as
> template<class T>
> void foo(T&& t);
>
> I like to call it generic functions because they related to ordinal
> functions like generic lambdas to ordinal lambdas.
>
> I understand that this is only a syntactic sugar (unlike with lambdas) but
> in times where functional and generic programming are so rising, it'
> important to have short way to define tamplate functions.

This is already part of C++17 (at least, of Concepts Lite).

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--

---
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/.

.


Author: oliora@gmail.com
Date: Mon, 13 Jul 2015 00:47:10 -0700 (PDT)
Raw View
------=_Part_59_55184070.1436773630267
Content-Type: multipart/alternative;
 boundary="----=_Part_60_1417734286.1436773630267"

------=_Part_60_1417734286.1436773630267
Content-Type: text/plain; charset=UTF-8

Hi Thiago,

I'm not in all details of Concepts Lite so probably I'm missed this
particular feature but AFAIK `auto` in Concepts used for another purpose
and Concepts Lite doen't allow to define function template without using of
template keyword.

On Monday, July 13, 2015 at 9:09:03 AM UTC+2, Thiago Macieira wrote:
>
> On Sunday 12 July 2015 23:58:45 oli...@gmail.com <javascript:> wrote:
> > Hello!
> >
> > What do you think about applying generic lambda approach to standard
> > function, like when you can use auto type for a standard function
> argument
> > to indicate that this function is in fact a function template accepting
> any
> > parameter type. For example:
> > void foo(auto&& arg);
> > should mean the same as
> > template<class T>
> > void foo(T&& t);
> >
> > I like to call it generic functions because they related to ordinal
> > functions like generic lambdas to ordinal lambdas.
> >
> > I understand that this is only a syntactic sugar (unlike with lambdas)
> but
> > in times where functional and generic programming are so rising, it'
> > important to have short way to define tamplate functions.
>
> This is already part of C++17 (at least, of Concepts Lite).
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>    Software Architect - Intel Open Source Technology Center
>       PGP/GPG: 0x6EF45358; fingerprint:
>       E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
>
>

--

---
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/.

------=_Part_60_1417734286.1436773630267
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Thiago,<br><br>I&#39;m not in all details of Concepts L=
ite so probably I&#39;m missed this particular feature but AFAIK `auto` in =
Concepts used for another purpose and Concepts Lite doen&#39;t allow to def=
ine function template without using of template keyword.<br><br>On Monday, =
July 13, 2015 at 9:09:03 AM UTC+2, Thiago Macieira wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;">On Sunday 12 July 2015 23:58:45 <a href=3D"java=
script:" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39=
;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39=
;;return true;">oli...@gmail.com</a> wrote:
<br>&gt; Hello!
<br>&gt;=20
<br>&gt; What do you think about applying generic lambda approach to standa=
rd
<br>&gt; function, like when you can use auto type for a standard function =
argument
<br>&gt; to indicate that this function is in fact a function template acce=
pting any
<br>&gt; parameter type. For example:
<br>&gt; void foo(auto&amp;&amp; arg);
<br>&gt; should mean the same as
<br>&gt; template&lt;class T&gt;
<br>&gt; void foo(T&amp;&amp; t);
<br>&gt;=20
<br>&gt; I like to call it generic functions because they related to ordina=
l
<br>&gt; functions like generic lambdas to ordinal lambdas.
<br>&gt;=20
<br>&gt; I understand that this is only a syntactic sugar (unlike with lamb=
das) but
<br>&gt; in times where functional and generic programming are so rising, i=
t&#39;
<br>&gt; important to have short way to define tamplate functions.
<br>
<br>This is already part of C++17 (at least, of Concepts Lite).
<br>
<br>--=20
<br>Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" target=
=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.goo=
gle.com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQ=
jCNEswDUBNCNanbu7euhqLn_62FW8ag&#39;;return true;" onclick=3D"this.href=3D&=
#39;http://www.google.com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46snt=
z\0751\46usg\75AFQjCNEswDUBNCNanbu7euhqLn_62FW8ag&#39;;return true;">maciei=
ra.info</a> - thiago (AT) <a href=3D"http://kde.org" target=3D"_blank" rel=
=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\7=
5http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo5_JYG1Dowztw=
AHAKs80XSA&#39;;return true;" onclick=3D"this.href=3D&#39;http://www.google=
..com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo=
5_JYG1DowztwAHAKs80XSA&#39;;return true;">kde.org</a>
<br>=C2=A0 =C2=A0Software Architect - Intel Open Source Technology Center
<br>=C2=A0 =C2=A0 =C2=A0 PGP/GPG: 0x6EF45358; fingerprint:
<br>=C2=A0 =C2=A0 =C2=A0 E067 918B B660 DBD1 105C =C2=A0966C 33F5 F005 6EF4=
 5358
<br>
<br></blockquote></div>

<p></p>

-- <br />
<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 <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 />
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 />

------=_Part_60_1417734286.1436773630267--
------=_Part_59_55184070.1436773630267--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 13 Jul 2015 13:13:07 +0300
Raw View
On 13 July 2015 at 10:47,  <oliora@gmail.com> wrote:
> Hi Thiago,
>
> I'm not in all details of Concepts Lite so probably I'm missed this
> particular feature but AFAIK `auto` in Concepts used for another purpose and
> Concepts Lite doen't allow to define function template without using of
> template keyword.

Based on http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4361.pdf,
Concepts Lite does allow defining function templates without using the template
keyword, just like Thiago says.

--

---
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/.

.


Author: oliora@gmail.com
Date: Mon, 13 Jul 2015 05:57:42 -0700 (PDT)
Raw View
------=_Part_4966_2025296863.1436792262968
Content-Type: multipart/alternative;
 boundary="----=_Part_4967_720070382.1436792262968"

------=_Part_4967_720070382.1436792262968
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

You are right, this feature is already proposed under name "abbreviated=20
function template", described in =C2=A78.3.5-16 of Concepts Lite spec (late=
st=20
one is http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4377.pdf).

Thank you for pointing me to it.

On Monday, July 13, 2015 at 12:13:09 PM UTC+2, Ville Voutilainen wrote:
>
> On 13 July 2015 at 10:47,  <oli...@gmail.com <javascript:>> wrote:=20
> > Hi Thiago,=20
> >=20
> > I'm not in all details of Concepts Lite so probably I'm missed this=20
> > particular feature but AFAIK `auto` in Concepts used for another purpos=
e=20
> and=20
> > Concepts Lite doen't allow to define function template without using of=
=20
> > template keyword.=20
>
> Based on http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4361.pdf,=
=20
> Concepts Lite does allow defining function templates without using the=20
> template=20
> keyword, just like Thiago says.=20
>

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_4967_720070382.1436792262968
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">You are right, this feature is already proposed under name=
 &quot;abbreviated function template&quot;, described in =C2=A78.3.5-16 of =
Concepts Lite spec (latest one is http://open-std.org/JTC1/SC22/WG21/docs/p=
apers/2015/n4377.pdf).<br><br>Thank you for pointing me to it.<br><br>On Mo=
nday, July 13, 2015 at 12:13:09 PM UTC+2, Ville Voutilainen wrote:<blockquo=
te class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left:=
 1px #ccc solid;padding-left: 1ex;">On 13 July 2015 at 10:47, =C2=A0&lt;<a =
href=3D"javascript:" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this=
..href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;jav=
ascript:&#39;;return true;">oli...@gmail.com</a>&gt; wrote:
<br>&gt; Hi Thiago,
<br>&gt;
<br>&gt; I&#39;m not in all details of Concepts Lite so probably I&#39;m mi=
ssed this
<br>&gt; particular feature but AFAIK `auto` in Concepts used for another p=
urpose and
<br>&gt; Concepts Lite doen&#39;t allow to define function template without=
 using of
<br>&gt; template keyword.
<br>
<br>Based on <a href=3D"http://open-std.org/JTC1/SC22/WG21/docs/papers/2015=
/n4361.pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&=
#39;http://www.google.com/url?q\75http%3A%2F%2Fopen-std.org%2FJTC1%2FSC22%2=
FWG21%2Fdocs%2Fpapers%2F2015%2Fn4361.pdf\46sa\75D\46sntz\0751\46usg\75AFQjC=
NEOsvgw3QZwLbwlej_EG3JKDdZfvw&#39;;return true;" onclick=3D"this.href=3D&#3=
9;http://www.google.com/url?q\75http%3A%2F%2Fopen-std.org%2FJTC1%2FSC22%2FW=
G21%2Fdocs%2Fpapers%2F2015%2Fn4361.pdf\46sa\75D\46sntz\0751\46usg\75AFQjCNE=
Osvgw3QZwLbwlej_EG3JKDdZfvw&#39;;return true;">http://open-std.org/JTC1/SC2=
2/WG21/docs/papers/2015/n4361.pdf</a>,
<br>Concepts Lite does allow defining function templates without using the =
template
<br>keyword, just like Thiago says.
<br></blockquote></div>

<p></p>

-- <br />
<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 <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 />
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 />

------=_Part_4967_720070382.1436792262968--
------=_Part_4966_2025296863.1436792262968--

.


Author: Casey Carter <cartec69@gmail.com>
Date: Thu, 16 Jul 2015 00:51:16 -0700 (PDT)
Raw View
------=_Part_306_521098420.1437033076731
Content-Type: multipart/alternative;
 boundary="----=_Part_307_886287936.1437033076731"

------=_Part_307_886287936.1437033076731
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Monday, July 13, 2015 at 7:57:43 AM UTC-5, oli...@gmail.com wrote:
>
> You are right, this feature is already proposed under name "abbreviated=
=20
> function template", described in =C2=A78.3.5-16 of Concepts Lite spec (la=
test=20
> one is http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4377.pdf).
>
> Thank you for pointing me to it.
>
>>
>>
Ironically enough, they were originally termed "generic functions," which=
=20
was later changed to "abbreviation function templates" because the original=
=20
name was considered to be too generic.

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_307_886287936.1437033076731
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Monday, July 13, 2015 at 7:57:43 AM UTC-5, oli...@gmail.com wrote:<block=
quote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-le=
ft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">You are right, this=
 feature is already proposed under name &quot;abbreviated function template=
&quot;, described in =C2=A78.3.5-16 of Concepts Lite spec (latest one is <a=
 href=3D"http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4377.pdf" tar=
get=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.=
google.com/url?q\75http%3A%2F%2Fopen-std.org%2FJTC1%2FSC22%2FWG21%2Fdocs%2F=
papers%2F2015%2Fn4377.pdf\46sa\75D\46sntz\0751\46usg\75AFQjCNFLAjL1YRoWP3wi=
DIrPTPgqCPTlbg&#39;;return true;" onclick=3D"this.href=3D&#39;http://www.go=
ogle.com/url?q\75http%3A%2F%2Fopen-std.org%2FJTC1%2FSC22%2FWG21%2Fdocs%2Fpa=
pers%2F2015%2Fn4377.pdf\46sa\75D\46sntz\0751\46usg\75AFQjCNFLAjL1YRoWP3wiDI=
rPTPgqCPTlbg&#39;;return true;">http://open-std.org/JTC1/SC22/WG21/docs/pap=
ers/2015/n4377.pdf</a>).<br><br>Thank you for pointing me to it.<br><blockq=
uote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:=
1px #ccc solid;padding-left:1ex"><br></blockquote></div></blockquote><div><=
br></div><div>Ironically enough, they were originally termed &quot;generic =
functions,&quot; which was later changed to &quot;abbreviation function tem=
plates&quot; because the original name was considered to be too generic.</d=
iv>

<p></p>

-- <br />
<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 <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 />
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 />

------=_Part_307_886287936.1437033076731--
------=_Part_306_521098420.1437033076731--

.