Topic: lambda template?
Author: =?UTF-8?B?7Jyk7ZuI64Ko?= <sim9108@naver.com>
Date: Sun, 31 Jan 2016 23:46:12 -0800 (PST)
Raw View
------=_Part_3997_1997152616.1454312772089
Content-Type: multipart/alternative;
boundary="----=_Part_3998_1062438517.1454312772089"
------=_Part_3998_1062438517.1454312772089
Content-Type: text/plain; charset=UTF-8
auto fn = []< typename T1, typename T2>(auto... args) {
std::cout << sizeof...(args) << std::endl;
};
fn<int, float>(2,3,4);
how about lambda template?
--
---
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 https://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_3998_1062438517.1454312772089
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div><br></div><div><div><span class=3D"Apple-tab-span=
" style=3D"white-space:pre"> </span>auto fn =3D []< typename T1, typenam=
e T2>(auto... args) {</div><div><span class=3D"Apple-tab-span" style=3D"=
white-space:pre"> </span>std::cout << sizeof...(args) << std::=
endl;</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> <=
/span>};</div><div><br></div><div><span class=3D"Apple-tab-span" style=3D"w=
hite-space:pre"> </span>fn<int, float>(2,3,4);</div></div><div><br></=
div><div><br></div><div>=C2=A0 =C2=A0 =C2=A0 how about lambda template?</di=
v></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />
------=_Part_3998_1062438517.1454312772089--
------=_Part_3997_1997152616.1454312772089--
.
Author: Patrice Roy <patricer@gmail.com>
Date: Mon, 1 Feb 2016 02:47:36 -0500
Raw View
--001a113ecbba309d61052ab09992
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
What would be the use in your example?
Cheers!
2016-02-01 2:46 GMT-05:00 =EC=9C=A4=ED=9B=88=EB=82=A8 <sim9108@naver.com>:
>
>
> auto fn =3D []< typename T1, typename T2>(auto... args) {
> std::cout << sizeof...(args) << std::endl;
> };
>
> fn<int, float>(2,3,4);
>
>
> how about lambda template?
>
> --
>
> ---
> 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
> https://groups.google.com/a/isocpp.org/group/std-proposals/.
>
--=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
--001a113ecbba309d61052ab09992
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>What would be the use in your example?<br><br></div>C=
heers!<br></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">2=
016-02-01 2:46 GMT-05:00 =EC=9C=A4=ED=9B=88=EB=82=A8 <span dir=3D"ltr"><=
<a href=3D"mailto:sim9108@naver.com" target=3D"_blank">sim9108@naver.com</a=
>></span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><div><=
br></div><div><div><span style=3D"white-space:pre-wrap"> </span>auto fn =3D=
[]< typename T1, typename T2>(auto... args) {</div><div><span style=
=3D"white-space:pre-wrap"> </span>std::cout << sizeof...(args) <&=
lt; std::endl;</div><div><span style=3D"white-space:pre-wrap"> </span>};</d=
iv><div><br></div><div><span style=3D"white-space:pre-wrap"> </span>fn<i=
nt, float>(2,3,4);</div></div><div><br></div><div><br></div><div>=C2=A0 =
=C2=A0 =C2=A0 how about lambda template?</div></div><span class=3D"HOEnZb">=
<font color=3D"#888888">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"https://groups.google.com/a/isocpp.org/group=
/std-proposals/" target=3D"_blank">https://groups.google.com/a/isocpp.org/g=
roup/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />
--001a113ecbba309d61052ab09992--
.
Author: =?UTF-8?B?7Jyk7ZuI64Ko?= <sim9108@naver.com>
Date: Sun, 31 Jan 2016 23:48:56 -0800 (PST)
Raw View
------=_Part_553_280954825.1454312936538
Content-Type: multipart/alternative;
boundary="----=_Part_554_1874934006.1454312936538"
------=_Part_554_1874934006.1454312936538
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
2016=EB=85=84 2=EC=9B=94 1=EC=9D=BC =EC=9B=94=EC=9A=94=EC=9D=BC =EC=98=A4=
=ED=9B=84 4=EC=8B=9C 46=EB=B6=84 12=EC=B4=88 UTC+9, =EC=9C=A4=ED=9B=88=EB=
=82=A8 =EB=8B=98=EC=9D=98 =EB=A7=90:
>
>
>
> auto fn =3D []< typename T1, typename T2>(auto... args) {
> std::cout << sizeof...(args) << std::endl;
> };
>
> fn<int, float>(2,3,4);
>
>
> how about lambda template?
>
struct __lambda{
template<typename T1, typename T2, typename... Args>
auto operator()(Args... args){
std::cout << sizeof...(args) << std::endl;
}
};
=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
------=_Part_554_1874934006.1454312936538
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>2016=EB=85=84 2=EC=9B=94 1=EC=9D=BC =EC=9B=94=EC=
=9A=94=EC=9D=BC =EC=98=A4=ED=9B=84 4=EC=8B=9C 46=EB=B6=84 12=EC=B4=88 UTC+9=
, =EC=9C=A4=ED=9B=88=EB=82=A8 =EB=8B=98=EC=9D=98 =EB=A7=90:<blockquote clas=
s=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #c=
cc solid;padding-left: 1ex;"><div dir=3D"ltr"><br><div><br></div><div><div>=
<span style=3D"white-space:pre"> </span>auto fn =3D []< typename T1, typ=
ename T2>(auto... args) {</div><div><span style=3D"white-space:pre"> </=
span>std::cout << sizeof...(args) << std::endl;</div><div><span=
style=3D"white-space:pre"> </span>};</div><div><br></div><div><span style=
=3D"white-space:pre"> </span>fn<int, float>(2,3,4);</div></div><div><=
br></div><div><br></div><div>=C2=A0 =C2=A0 =C2=A0 how about lambda template=
?</div></div></blockquote><div><br><br>=C2=A0 =C2=A0struct __lambda{</div><=
div><br></div><div>=C2=A0 =C2=A0 =C2=A0template<typename T1, typename T2=
, typename... Args></div><div>=C2=A0 =C2=A0 =C2=A0 auto operator()(Args.=
... args){</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std::cout << sizeof..=
..(args) << std::endl;</div><div>=C2=A0 =C2=A0 =C2=A0 }</div><div><br>=
</div><div>=C2=A0 =C2=A0 =C2=A0};<br>=C2=A0</div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />
------=_Part_554_1874934006.1454312936538--
------=_Part_553_280954825.1454312936538--
.
Author: =?UTF-8?B?7Jyk7ZuI64Ko?= <sim9108@naver.com>
Date: Sun, 31 Jan 2016 23:55:36 -0800 (PST)
Raw View
------=_Part_4006_2067010950.1454313336284
Content-Type: multipart/alternative;
boundary="----=_Part_4007_682247633.1454313336285"
------=_Part_4007_682247633.1454313336285
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
std::string f(std::string, std::string) {
}
template<typename... TS>
auto operator()(TS&&... ts1) {
auto fn =3D [ &ts1...]<TS...>(auto&&... args) mutable {
return f(std::forward<TS>(ts1)..., std::forward<decltype(args)>(args)...);
};
}
/// ts1 in lambda function -->perfect forwarding
just lambda capture by ref.
lambda functio body -> std::forward<TS>(ts1)... =3D=3D>perfect forwarding=
in=20
lambda function.
2016=EB=85=84 2=EC=9B=94 1=EC=9D=BC =EC=9B=94=EC=9A=94=EC=9D=BC =EC=98=A4=
=ED=9B=84 4=EC=8B=9C 47=EB=B6=84 37=EC=B4=88 UTC+9, Patrice Roy =EB=8B=98=
=EC=9D=98 =EB=A7=90:
>
> What would be the use in your example?
>
> Cheers!
>
> 2016-02-01 2:46 GMT-05:00 =EC=9C=A4=ED=9B=88=EB=82=A8 <sim...@naver.com <=
javascript:>>:
>
>>
>>
>> auto fn =3D []< typename T1, typename T2>(auto... args) {
>> std::cout << sizeof...(args) << std::endl;
>> };
>>
>> fn<int, float>(2,3,4);
>>
>>
>> how about lambda template?
>>
>> --=20
>>
>> ---=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> Visit this group at=20
>> https://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>
--=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
------=_Part_4007_682247633.1454313336285
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><div>std::string f(std::string, std::string) {</div><=
div><br></div><div>}</div><div><br></div><div>template<typename... TS>=
;</div><div>auto operator()(TS&&... ts1) {</div><div><span class=3D=
"Apple-tab-span" style=3D"white-space:pre"> </span>auto fn =3D [ &ts1..=
..]<TS...>(auto&&... args) mutable {</div><div><span class=3D"=
Apple-tab-span" style=3D"white-space:pre"> </span>return f(std::forward<=
;TS>(ts1)..., std::forward<decltype(args)>(args)...);</div><div><s=
pan class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>};</div><div=
>}</div></div><div>/// ts1 in lambda function -->perfect forwarding</div=
><div>=C2=A0just lambda capture =C2=A0by ref.</div><div>=C2=A0lambda functi=
o body -> std::forward<TS>(ts1)... =C2=A0=3D=3D>perfect forward=
ing in lambda function.</div><div><br></div><br><br>2016=EB=85=84 2=EC=9B=
=94 1=EC=9D=BC =EC=9B=94=EC=9A=94=EC=9D=BC =EC=98=A4=ED=9B=84 4=EC=8B=9C 47=
=EB=B6=84 37=EC=B4=88 UTC+9, Patrice Roy =EB=8B=98=EC=9D=98 =EB=A7=90:<bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>What would be=
the use in your example?<br><br></div>Cheers!<br></div><div><br><div class=
=3D"gmail_quote">2016-02-01 2:46 GMT-05:00 =EC=9C=A4=ED=9B=88=EB=82=A8 <spa=
n dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-=
mailto=3D"tfsr0N2TGwAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'ja=
vascript:';return true;" onclick=3D"this.href=3D'javascript:';r=
eturn true;">sim...@naver.com</a>></span>:<br><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex"><div dir=3D"ltr"><br><div><br></div><div><div><span style=3D"white-spa=
ce:pre-wrap"> </span>auto fn =3D []< typename T1, typename T2>(auto..=
.. args) {</div><div><span style=3D"white-space:pre-wrap"> </span>std::cout=
<< sizeof...(args) << std::endl;</div><div><span style=3D"whit=
e-space:pre-wrap"> </span>};</div><div><br></div><div><span style=3D"white-=
space:pre-wrap"> </span>fn<int, float>(2,3,4);</div></div><div><br></=
div><div><br></div><div>=C2=A0 =C2=A0 =C2=A0 how about lambda template?</di=
v></div><span><font color=3D"#888888">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
tfsr0N2TGwAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:&=
#39;;return true;" onclick=3D"this.href=3D'javascript:';return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"tfsr0N2TGwAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'=
;javascript:';return true;">std-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"https://groups.google.com/a/isocpp.org/group=
/std-proposals/" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.hre=
f=3D'https://groups.google.com/a/isocpp.org/group/std-proposals/';r=
eturn true;" onclick=3D"this.href=3D'https://groups.google.com/a/isocpp=
..org/group/std-proposals/';return true;">https://groups.google.com/a/<w=
br>isocpp.org/group/std-<wbr>proposals/</a>.<br>
</font></span></blockquote></div><br></div>
</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" 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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />
------=_Part_4007_682247633.1454313336285--
------=_Part_4006_2067010950.1454313336284--
.
Author: =?UTF-8?B?7Jyk7ZuI64Ko?= <sim9108@naver.com>
Date: Mon, 1 Feb 2016 00:02:18 -0800 (PST)
Raw View
------=_Part_580_566123523.1454313738506
Content-Type: multipart/alternative;
boundary="----=_Part_581_567201847.1454313738506"
------=_Part_581_567201847.1454313738506
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
lambda capture by value.
lambda capture by ref.
lambda capture by type??=20
2016=EB=85=84 2=EC=9B=94 1=EC=9D=BC =EC=9B=94=EC=9A=94=EC=9D=BC =EC=98=A4=
=ED=9B=84 4=EC=8B=9C 47=EB=B6=84 37=EC=B4=88 UTC+9, Patrice Roy =EB=8B=98=
=EC=9D=98 =EB=A7=90:
>
> What would be the use in your example?
>
> Cheers!
>
> 2016-02-01 2:46 GMT-05:00 =EC=9C=A4=ED=9B=88=EB=82=A8 <sim...@naver.com <=
javascript:>>:
>
>>
>>
>> auto fn =3D []< typename T1, typename T2>(auto... args) {
>> std::cout << sizeof...(args) << std::endl;
>> };
>>
>> fn<int, float>(2,3,4);
>>
>>
>> how about lambda template?
>>
>> --=20
>>
>> ---=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> Visit this group at=20
>> https://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>
--=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
------=_Part_581_567201847.1454313738506
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">lambda capture by value.<div>lambda capture by ref.<br></d=
iv><div>lambda capture by type??=C2=A0<br></div><div><br><br>2016=EB=85=84 =
2=EC=9B=94 1=EC=9D=BC =EC=9B=94=EC=9A=94=EC=9D=BC =EC=98=A4=ED=9B=84 4=EC=
=8B=9C 47=EB=B6=84 37=EC=B4=88 UTC+9, Patrice Roy =EB=8B=98=EC=9D=98 =EB=A7=
=90:<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>What=
would be the use in your example?<br><br></div>Cheers!<br></div><div><br><=
div class=3D"gmail_quote">2016-02-01 2:46 GMT-05:00 =EC=9C=A4=ED=9B=88=EB=
=82=A8 <span dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-=
obfuscated-mailto=3D"tfsr0N2TGwAJ" rel=3D"nofollow" onmousedown=3D"this.hre=
f=3D'javascript:';return true;" onclick=3D"this.href=3D'javascr=
ipt:';return true;">sim...@naver.com</a>></span>:<br><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa=
dding-left:1ex"><div dir=3D"ltr"><br><div><br></div><div><div><span style=
=3D"white-space:pre-wrap"> </span>auto fn =3D []< typename T1, typename =
T2>(auto... args) {</div><div><span style=3D"white-space:pre-wrap"> </s=
pan>std::cout << sizeof...(args) << std::endl;</div><div><span =
style=3D"white-space:pre-wrap"> </span>};</div><div><br></div><div><span st=
yle=3D"white-space:pre-wrap"> </span>fn<int, float>(2,3,4);</div></di=
v><div><br></div><div><br></div><div>=C2=A0 =C2=A0 =C2=A0 how about lambda =
template?</div></div><span><font color=3D"#888888">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
tfsr0N2TGwAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:&=
#39;;return true;" onclick=3D"this.href=3D'javascript:';return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"tfsr0N2TGwAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'=
;javascript:';return true;">std-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"https://groups.google.com/a/isocpp.org/group=
/std-proposals/" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.hre=
f=3D'https://groups.google.com/a/isocpp.org/group/std-proposals/';r=
eturn true;" onclick=3D"this.href=3D'https://groups.google.com/a/isocpp=
..org/group/std-proposals/';return true;">https://groups.google.com/a/<w=
br>isocpp.org/group/std-<wbr>proposals/</a>.<br>
</font></span></blockquote></div><br></div>
</blockquote></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />
------=_Part_581_567201847.1454313738506--
------=_Part_580_566123523.1454313738506--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 01 Feb 2016 09:28:35 -0800
Raw View
On Sunday 31 January 2016 23:48:56 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:
> struct __lambda{
>=20
> template<typename T1, typename T2, typename... Args>
> auto operator()(Args... args){
> std::cout << sizeof...(args) << std::endl;
> }
>=20
> };
> =20
You didn't use T1 or T2 anywhere. What's the point of having them in the fi=
rst=20
place?
--=20
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
--=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
.
Author: =?UTF-8?B?7Jyk7ZuI64Ko?= <sim9108@naver.com>
Date: Mon, 1 Feb 2016 17:53:44 -0800 (PST)
Raw View
------=_Part_5456_936621814.1454378024958
Content-Type: multipart/alternative;
boundary="----=_Part_5457_1033027143.1454378024958"
------=_Part_5457_1033027143.1454378024958
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
for example)
std::string f(std::string, std::string, std::string, std::string, int, int,=
=20
float) {
}
template<typename... TS>
auto test(TS&&... ts1) {
auto fn =3D [&ts1...]<TS...>(auto&&... args) mutable {
return f(std::forward<TS>(ts1)..., std::forward<decltype(args)>(args)...);
};
}
/// ts1 in lambda function -->perfect forwarding
just lambda capture by ref.
lambda functio body->std::forward<TS>(ts1)... =3D=3D >perfect forwarding in=
=20
lambda function. capture block perfect forwarding and args perfect=20
forwarding
2016=EB=85=84 2=EC=9B=94 2=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=A4=
=EC=A0=84 2=EC=8B=9C 28=EB=B6=84 46=EC=B4=88 UTC+9, Thiago Macieira =EB=8B=
=98=EC=9D=98 =EB=A7=90:
>
> On Sunday 31 January 2016 23:48:56 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:=20
> > struct __lambda{=20
> >=20
> > template<typename T1, typename T2, typename... Args>=20
> > auto operator()(Args... args){=20
> > std::cout << sizeof...(args) << std::endl;=20
> > }=20
> >=20
> > };=20
> > =20
>
> You didn't use T1 or T2 anywhere. What's the point of having them in the=
=20
> first=20
> place?=20
> --=20
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org=20
> Software Architect - Intel Open Source Technology Center=20
> PGP/GPG: 0x6EF45358; fingerprint:=20
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
------=_Part_5457_1033027143.1454378024958
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">for example)<div><br></div><div><div>std::string f(std::st=
ring, std::string, std::string, std::string, int, int, float) {</div><div>}=
<br></div><div><br></div><div>template<typename... TS></div><div>auto=
test(TS&&... ts1) {</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span>auto fn =3D [&ts1...]<TS...>(auto&am=
p;&... args) mutable {</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span>return f(std::forward<TS>(ts1)..., std:=
:forward<decltype(args)>(args)...);</div><div><span class=3D"Apple-ta=
b-span" style=3D"white-space:pre"> </span>};</div><div>}</div><div><br></di=
v><div>/// ts1 in lambda function -->perfect forwarding</div><div>just l=
ambda capture =C2=A0by ref.</div><div>lambda functio body->std::forward&=
lt;TS>(ts1)... =3D=3D >perfect forwarding in lambda function. capture=
block perfect forwarding and args perfect forwarding</div><div><br></div><=
br>2016=EB=85=84 2=EC=9B=94 2=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=
=A4=EC=A0=84 2=EC=8B=9C 28=EB=B6=84 46=EC=B4=88 UTC+9, Thiago Macieira =EB=
=8B=98=EC=9D=98 =EB=A7=90:<blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On S=
unday 31 January 2016 23:48:56 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:
<br>> =C2=A0 =C2=A0struct __lambda{
<br>>=20
<br>> =C2=A0 =C2=A0 =C2=A0template<typename T1, typename T2, typename=
.... Args>
<br>> =C2=A0 =C2=A0 =C2=A0 auto operator()(Args... args){
<br>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 std::cout << sizeof...(args) <=
;< std::endl;
<br>> =C2=A0 =C2=A0 =C2=A0 }
<br>>=20
<br>> =C2=A0 =C2=A0 =C2=A0};
<br>> =C2=A0
<br>
<br>You didn't use T1 or T2 anywhere. What's the point of having th=
em in the first=20
<br>place?
<br>--=20
<br>Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" target=
=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www.goo=
gle.com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQ=
jCNEswDUBNCNanbu7euhqLn_62FW8ag';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';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'http://www.google.com/url?q\7=
5http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo5_JYG1Dowztw=
AHAKs80XSA';return true;" onclick=3D"this.href=3D'http://www.google=
..com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo=
5_JYG1DowztwAHAKs80XSA';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></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />
------=_Part_5457_1033027143.1454378024958--
------=_Part_5456_936621814.1454378024958--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 01 Feb 2016 19:21:11 -0800
Raw View
On Monday 01 February 2016 17:53:44 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:
> for example)
>=20
> std::string f(std::string, std::string, std::string, std::string, int, in=
t,
> float) {
> }
>=20
> template<typename... TS>
> auto test(TS&&... ts1) {
> auto fn =3D [&ts1...]<TS...>(auto&&... args) mutable {
> return f(std::forward<TS>(ts1)..., std::forward<decltype(args)>(args)...)=
;
> };
return fn; // was missing
> }
Why do you need the <TS...> in the lambda declaration? This example works=
=20
without it.
Can you give a concrete example of where this would be needed? Not somethin=
g=20
that shows how this could be used if it existed, but something that shows h=
ow=20
it solves a problem that was either not solved before or wasn't as easy to=
=20
solve.
--=20
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
--=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
.
Author: =?UTF-8?B?7Jyk7ZuI64Ko?= <sim9108@naver.com>
Date: Mon, 1 Feb 2016 20:03:32 -0800 (PST)
Raw View
------=_Part_1007_1303576077.1454385813139
Content-Type: multipart/alternative;
boundary="----=_Part_1008_477889584.1454385813140"
------=_Part_1008_477889584.1454385813140
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
#include <iostream>
#include <string>
// Move or Copy Check
struct CheckString {
std::string data_{ "hello" };
CheckString() =3D default;
CheckString(const CheckString& rhs) : data_{ rhs.data_ } {
std::cout << "copying\n";
}
CheckString(CheckString&& rhs) : data_{ std::move(rhs.data_) } {
std::cout << "moving\n";
}
};
void f(CheckString ts1, CheckString ts2, CheckString arg1, CheckString=20
arg2) {
}
//#case 1
template<typename... TS>
auto test(TS&&... ts1) {
return [&ts1...](auto&&... args) mutable {
// error 'TS': parameter pack must be expanded in this context
// TS type not capture. just value capture.
return f(std::forward<TS>(ts1)..., std::forward<decltype(args)>(args)...)
};
}
//case 2
template<typename... TS>
auto test(TS&&... ts1) {
//error syntax error: missing ']' before '=3D'
// forward to lambda capture--> using in lambda body
return[ts...=3D std::forward<TS>(ts1)...](auto&&... args) mutable {
return f(ts..., std::forward<decltype(args)>(args)...)
};
}
//case 3
template<typename... TS>
auto test(TS&&... ts1) {
//C3260: '<': skipping unexpected token(s) before lambda body
// lambda type capture can??=20
return[&ts1...]<TS...>(auto&&... args) mutable {
return f(std::forward<TS>(ts1)..., std::forward<decltype(args)>(args)...)
};
}
int main() {
CheckString ts1, ts2, arg1, arg2;
auto fn =3D test(ts1, std::move(ts2));
fn(arg1, std::move(arg2));
// ts2, arg2 ->moving
// ts1, arg1 ->copying
}
Something seems to be possible also for other purposes, a variety of uses.
2016=EB=85=84 2=EC=9B=94 2=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=A4=
=ED=9B=84 12=EC=8B=9C 21=EB=B6=84 25=EC=B4=88 UTC+9, Thiago Macieira =EB=8B=
=98=EC=9D=98 =EB=A7=90:
>
> On Monday 01 February 2016 17:53:44 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:=20
> > for example)=20
> >=20
> > std::string f(std::string, std::string, std::string, std::string, int,=
=20
> int,=20
> > float) {=20
> > }=20
> >=20
> > template<typename... TS>=20
> > auto test(TS&&... ts1) {=20
> > auto fn =3D [&ts1...]<TS...>(auto&&... args) mutable {=20
> > return f(std::forward<TS>(ts1)...,=20
> std::forward<decltype(args)>(args)...);=20
> > };=20
> return fn; // was missing=20
> > }=20
>
> Why do you need the <TS...> in the lambda declaration? This example works=
=20
> without it.=20
>
> Can you give a concrete example of where this would be needed? Not=20
> something=20
> that shows how this could be used if it existed, but something that shows=
=20
> how=20
> it solves a problem that was either not solved before or wasn't as easy t=
o=20
> solve.=20
>
> --=20
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org=20
> Software Architect - Intel Open Source Technology Center=20
> PGP/GPG: 0x6EF45358; fingerprint:=20
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
------=_Part_1008_477889584.1454385813140
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>#include <iostream></div><div>#include <stri=
ng></div><div>// Move or Copy Check</div><div>struct CheckString {</div>=
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>std::=
string data_{ "hello" };</div><div><span class=3D"Apple-tab-span"=
style=3D"white-space:pre"> </span>CheckString() =3D default;</div><div><sp=
an class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>CheckString(c=
onst CheckString& rhs) : data_{ rhs.data_ } {</div><div><span class=3D"=
Apple-tab-span" style=3D"white-space:pre"> </span>std::cout << "=
;copying\n";</div><div><span class=3D"Apple-tab-span" style=3D"white-s=
pace:pre"> </span>}</div><div><br></div><div><span class=3D"Apple-tab-span"=
style=3D"white-space:pre"> </span>CheckString(CheckString&& rhs) :=
data_{ std::move(rhs.data_) } {</div><div><span class=3D"Apple-tab-span" s=
tyle=3D"white-space:pre"> </span>std::cout << "moving\n";<=
/div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>=
}</div><div>};</div><div><br></div><div>void f(CheckString ts1, CheckString=
ts2, CheckString arg1, CheckString arg2) {</div><div>}</div><div><br></div=
><div>//#case 1</div><div>template<typename... TS></div><div>auto tes=
t(TS&&... ts1) {</div><div><span class=3D"Apple-tab-span" style=3D"=
white-space:pre"> </span>return =C2=A0[&ts1...](auto&&... args)=
mutable {</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pr=
e"> </span>// error 'TS': parameter pack must be expanded in this =
context</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">=
</span>// TS type not capture. just value capture.</div><div><span class=
=3D"Apple-tab-span" style=3D"white-space:pre"> </span>return f(std::forwar=
d<TS>(ts1)..., std::forward<decltype(args)>(args)...)</div><div=
><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>};</div><=
div>}</div><div><br></div><div>//case 2</div><div>template<typename... T=
S></div><div>auto test(TS&&... ts1) {</div><div><span class=3D"A=
pple-tab-span" style=3D"white-space:pre"> </span>//error syntax error: miss=
ing ']' before '=3D'</div><div><span class=3D"Apple-tab-spa=
n" style=3D"white-space:pre"> </span>// forward to lambda capture--> usi=
ng in lambda body</div><div><span class=3D"Apple-tab-span" style=3D"white-s=
pace:pre"> </span>return[ts...=3D std::forward<TS>(ts1)...](auto&=
&... args) mutable {</div><div><span class=3D"Apple-tab-span" style=3D"=
white-space:pre"> </span>return f(ts..., std::forward<decltype(args)>=
;(args)...)</div><div><span class=3D"Apple-tab-span" style=3D"white-space:p=
re"> </span>};</div><div>}</div><div><br></div><div>//case 3</div><div>temp=
late<typename... TS></div><div>auto test(TS&&... ts1) {</div>=
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>//C32=
60: '<': skipping unexpected token(s) before lambda body</div><d=
iv><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>// lamb=
da type capture can??<span class=3D"Apple-tab-span" style=3D"white-space:pr=
e"> </span></div><div><span class=3D"Apple-tab-span" style=3D"white-space:p=
re"> </span>return[&ts1...]<TS...>(auto&&... args) mutabl=
e {</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </=
span>return f(std::forward<TS>(ts1)..., std::forward<decltype(args=
)>(args)...)</div><div><span class=3D"Apple-tab-span" style=3D"white-spa=
ce:pre"> </span>};</div><div>}</div><div><br></div><div>int main() {</div><=
div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>CheckS=
tring ts1, ts2, arg1, arg2;</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span>auto fn =3D test(ts1, std::move(ts2));</div><d=
iv><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>fn(arg1=
, std::move(arg2));</div><div><span class=3D"Apple-tab-span" style=3D"white=
-space:pre"> </span>// ts2, arg2 ->moving</div><div><span class=3D"Appl=
e-tab-span" style=3D"white-space:pre"> </span>// ts1, arg1 ->copying</d=
iv><div>}</div><div><br></div><div>Something seems to be possible also for =
other purposes, a variety of uses.<br></div><br>2016=EB=85=84 2=EC=9B=94 2=
=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=A4=ED=9B=84 12=EC=8B=9C 21=EB=
=B6=84 25=EC=B4=88 UTC+9, Thiago Macieira =EB=8B=98=EC=9D=98 =EB=A7=90:<blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-=
left: 1px #ccc solid;padding-left: 1ex;">On Monday 01 February 2016 17:53:4=
4 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:
<br>> for example)
<br>>=20
<br>> std::string f(std::string, std::string, std::string, std::string, =
int, int,
<br>> float) {
<br>> }
<br>>=20
<br>> template<typename... TS>
<br>> auto test(TS&&... ts1) {
<br>> auto fn =3D [&ts1...]<TS...>(auto&&... args) mut=
able {
<br>> return f(std::forward<TS>(ts1)..., std::forward<decltype(=
args)>(<wbr>args)...);
<br>> };
<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return fn;=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0// was missing
<br>> }
<br>
<br>Why do you need the <TS...> in the lambda declaration? This examp=
le works=20
<br>without it.
<br>
<br>Can you give a concrete example of where this would be needed? Not some=
thing=20
<br>that shows how this could be used if it existed, but something that sho=
ws how=20
<br>it solves a problem that was either not solved before or wasn't as =
easy to=20
<br>solve.
<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'http://www.goo=
gle.com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQ=
jCNEswDUBNCNanbu7euhqLn_62FW8ag';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';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'http://www.google.com/url?q\7=
5http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo5_JYG1Dowztw=
AHAKs80XSA';return true;" onclick=3D"this.href=3D'http://www.google=
..com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo=
5_JYG1DowztwAHAKs80XSA';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" 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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />
------=_Part_1008_477889584.1454385813140--
------=_Part_1007_1303576077.1454385813139--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 01 Feb 2016 22:33:21 -0800
Raw View
On Monday 01 February 2016 20:03:32 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:
> #include <iostream>
> #include <string>
> // Move or Copy Check
> struct CheckString {
> std::string data_{ "hello" };
> CheckString() =3D default;
> CheckString(const CheckString& rhs) : data_{ rhs.data_ } {
> std::cout << "copying\n";
> }
>=20
> CheckString(CheckString&& rhs) : data_{ std::move(rhs.data_) } {
> std::cout << "moving\n";
> }
> };
>=20
> void f(CheckString ts1, CheckString ts2, CheckString arg1, CheckString
> arg2) {
> }
>=20
> //#case 1
> template<typename... TS>
> auto test(TS&&... ts1) {
> return [&ts1...](auto&&... args) mutable {
> // error 'TS': parameter pack must be expanded in this context
> // TS type not capture. just value capture.
> return f(std::forward<TS>(ts1)..., std::forward<decltype(args)>(args)...)
> };
> }
No error here, Clang 3.7, GCC 5.3, ICC 16.0.
> int main() {
> CheckString ts1, ts2, arg1, arg2;
> auto fn =3D test(ts1, std::move(ts2));
> fn(arg1, std::move(arg2));
> // ts2, arg2 ->moving
> // ts1, arg1 ->copying
> }
>=20
> Something seems to be possible also for other purposes, a variety of uses=
..
Please explain with words what this is supposed to do. And considering case=
1=20
works, why do we need cases 2 or 3?
--=20
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
--=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
.
Author: =?UTF-8?B?7Jyk7ZuI64Ko?= <sim9108@naver.com>
Date: Mon, 1 Feb 2016 23:40:05 -0800 (PST)
Raw View
------=_Part_2344_1101567846.1454398806092
Content-Type: multipart/alternative;
boundary="----=_Part_2345_2103080339.1454398806093"
------=_Part_2345_2103080339.1454398806093
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
#include <iostream>
#include <string>
// Move or Copy Check
struct CheckString {
std::string data_{ "hello" };
CheckString() =3D default;
CheckString(const CheckString& rhs) : data_{ rhs.data_ } {
std::cout << "copying\n";
}
CheckString(CheckString&& rhs) : data_{ std::move(rhs.data_) } {
std::cout << "moving\n";
}
};
void f(CheckString a, CheckString b, CheckString c, CheckString d) {
}
//#case 1
template<typename... TS>
auto test(TS&&... ts1) {
=20
return [&ts1...](auto&&... args) mutable {
// error 'TS': parameter pack must be expanded in this context
// TS type not capture. just value capture.
return f(std::forward<TS>(ts1)..., std::forward<decltype(args)>(args)...);
};
}
//case 2
template<typename... TS>
auto test(TS&&... ts1) {
//error syntax error: missing ']' before '=3D'
// forward to lambda capture--> using in lambda body
return[ts...=3D std::forward<TS>(ts1)...](auto&&... args) mutable {
return f(ts..., std::forward<decltype(args)>(args)...);
};
}
// make_lambda function
auto make_lamba(){
CheckString ts1, ts2;
return test(ts1, std::move(ts2));
}
int main() {
CheckString arg1, arg2;
auto fn =3Dmake_lamba();
fn(arg1, std::move(arg2)); //print error;
}
In the case of the case 1,
ts1 is simply a reference.
Therefore, depending on the time the call is at risk.
That incomplete forwarding
case 2 is captured by an explicit forwarding.
2016=EB=85=84 2=EC=9B=94 2=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=A4=
=ED=9B=84 3=EC=8B=9C 33=EB=B6=84 24=EC=B4=88 UTC+9, Thiago Macieira =EB=8B=
=98=EC=9D=98 =EB=A7=90:
>
> On Monday 01 February 2016 20:03:32 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:=20
> > #include <iostream>=20
> > #include <string>=20
> > // Move or Copy Check=20
> > struct CheckString {=20
> > std::string data_{ "hello" };=20
> > CheckString() =3D default;=20
> > CheckString(const CheckString& rhs) : data_{ rhs.data_ } {=20
> > std::cout << "copying\n";=20
> > }=20
> >=20
> > CheckString(CheckString&& rhs) : data_{ std::move(rhs.data_) } {=20
> > std::cout << "moving\n";=20
> > }=20
> > };=20
> >=20
> > void f(CheckString ts1, CheckString ts2, CheckString arg1, CheckString=
=20
> > arg2) {=20
> > }=20
> >=20
> > //#case 1=20
> > template<typename... TS>=20
> > auto test(TS&&... ts1) {=20
> > return [&ts1...](auto&&... args) mutable {=20
> > // error 'TS': parameter pack must be expanded in this context=20
> > // TS type not capture. just value capture.=20
> > return f(std::forward<TS>(ts1)...,=20
> std::forward<decltype(args)>(args)...)=20
> > };=20
> > }=20
>
> No error here, Clang 3.7, GCC 5.3, ICC 16.0.=20
>
> > int main() {=20
> > CheckString ts1, ts2, arg1, arg2;=20
> > auto fn =3D test(ts1, std::move(ts2));=20
> > fn(arg1, std::move(arg2));=20
> > // ts2, arg2 ->moving=20
> > // ts1, arg1 ->copying=20
> > }=20
> >=20
> > Something seems to be possible also for other purposes, a variety of=20
> uses.=20
>
> Please explain with words what this is supposed to do. And considering=20
> case 1=20
> works, why do we need cases 2 or 3?=20
>
> --=20
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org=20
> Software Architect - Intel Open Source Technology Center=20
> PGP/GPG: 0x6EF45358; fingerprint:=20
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
------=_Part_2345_2103080339.1454398806093
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>#include <iostream></div><div>#include <stri=
ng></div><div>// Move or Copy Check</div><div>struct CheckString {</div>=
<div>=C2=A0 =C2=A0 std::string data_{ "hello" };</div><div><span =
class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>CheckString() =
=3D default;</div><div><span class=3D"Apple-tab-span" style=3D"white-space:=
pre"> </span>CheckString(const CheckString& rhs) : data_{ rhs.data_ } {=
</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </spa=
n>std::cout << "copying\n";</div><div><span class=3D"Apple-=
tab-span" style=3D"white-space:pre"> </span>}</div><div><br></div><div><spa=
n class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>CheckString(Ch=
eckString&& rhs) : data_{ std::move(rhs.data_) } {</div><div><span =
class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>std::cout <&=
lt; "moving\n";</div><div><span class=3D"Apple-tab-span" style=3D=
"white-space:pre"> </span>}</div><div>};</div><div><br></div><div>void f(Ch=
eckString a, CheckString b, CheckString c, CheckString d) {</div><div>}</di=
v><div><br></div><div>//#case 1</div><div>template<typename... TS></d=
iv><div>auto test(TS&&... ts1) {</div><div>=C2=A0 =C2=A0=C2=A0</div=
><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>retu=
rn =C2=A0[&ts1...](auto&&... args) mutable {</div><div><span cl=
ass=3D"Apple-tab-span" style=3D"white-space:pre"> </span>// error 'TS&=
#39;: parameter pack must be expanded in this context</div><div><span class=
=3D"Apple-tab-span" style=3D"white-space:pre"> </span>// TS type not captu=
re. just value capture.</div><div><span class=3D"Apple-tab-span" style=3D"w=
hite-space:pre"> </span>return f(std::forward<TS>(ts1)..., std::forw=
ard<decltype(args)>(args)...);</div><div><span class=3D"Apple-tab-spa=
n" style=3D"white-space:pre"> </span>};</div><div>}</div><div><br></div><di=
v><div>//case 2</div><div>template<typename... TS></div><div>auto tes=
t(TS&&... ts1) {</div><div><span class=3D"Apple-tab-span" style=3D"=
white-space:pre"> </span>//error syntax error: missing ']' before &=
#39;=3D'</div><div><span class=3D"Apple-tab-span" style=3D"white-space:=
pre"> </span>// forward to lambda capture--> using in lambda body</div><=
div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>return=
[ts...=3D std::forward<TS>(ts1)...](auto&&... args) mutable {=
</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </spa=
n>return f(ts..., std::forward<decltype(args)>(args)...);</div><div><=
span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>};</div><di=
v>}</div></div><div><br></div><div>// make_lambda function</div><div>auto m=
ake_lamba(){</div><div>=C2=A0 =C2=A0 CheckString ts1, ts2;</div><div>=C2=A0=
=C2=A0 return test(ts1, std::move(ts2));</div><div>}</div><div><br></div><=
div>int main() {</div><div><span class=3D"Apple-tab-span" style=3D"white-sp=
ace:pre"> </span>CheckString arg1, arg2;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 auto fn =3Dmake_lamba();</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span>fn(arg1, std::move(arg2)); //print error;</div=
><div>}</div><div><br></div><div><div>In the case of the case 1,</div><div>=
ts1 is simply a reference.</div><div>Therefore, depending on the time the c=
all is at risk.</div><div>That incomplete forwarding</div><div><br></div><d=
iv>case 2 is captured by an explicit forwarding.</div></div><div><br></div>=
<br>2016=EB=85=84 2=EC=9B=94 2=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=
=A4=ED=9B=84 3=EC=8B=9C 33=EB=B6=84 24=EC=B4=88 UTC+9, Thiago Macieira =EB=
=8B=98=EC=9D=98 =EB=A7=90:<blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On M=
onday 01 February 2016 20:03:32 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:
<br>> #include <iostream>
<br>> #include <string>
<br>> // Move or Copy Check
<br>> struct CheckString {
<br>> std::string data_{ "hello" };
<br>> CheckString() =3D default;
<br>> CheckString(const CheckString& rhs) : data_{ rhs.data_ } {
<br>> std::cout << "copying\n";
<br>> }
<br>>=20
<br>> CheckString(CheckString&& rhs) : data_{ std::move(rhs.data=
_) } {
<br>> std::cout << "moving\n";
<br>> }
<br>> };
<br>>=20
<br>> void f(CheckString ts1, CheckString ts2, CheckString arg1, CheckSt=
ring
<br>> arg2) {
<br>> }
<br>>=20
<br>> //#case 1
<br>> template<typename... TS>
<br>> auto test(TS&&... ts1) {
<br>> return =C2=A0[&ts1...](auto&&... args) mutable {
<br>> // error 'TS': parameter pack must be expanded in this con=
text
<br>> // TS type not capture. just value capture.
<br>> return f(std::forward<TS>(ts1)..., std::forward<decltype(=
args)>(<wbr>args)...)
<br>> };
<br>> }
<br>
<br>No error here, Clang 3.7, GCC 5.3, ICC 16.0.
<br>
<br>> int main() {
<br>> CheckString ts1, ts2, arg1, arg2;
<br>> auto fn =3D test(ts1, std::move(ts2));
<br>> fn(arg1, std::move(arg2));
<br>> // ts2, arg2 ->moving
<br>> // ts1, arg1 ->copying
<br>> }
<br>>=20
<br>> Something seems to be possible also for other purposes, a variety =
of uses.
<br>
<br>Please explain with words what this is supposed to do. And considering =
case 1=20
<br>works, why do we need cases 2 or 3?
<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'http://www.goo=
gle.com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQ=
jCNEswDUBNCNanbu7euhqLn_62FW8ag';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';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'http://www.google.com/url?q\7=
5http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo5_JYG1Dowztw=
AHAKs80XSA';return true;" onclick=3D"this.href=3D'http://www.google=
..com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo=
5_JYG1DowztwAHAKs80XSA';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" 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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />
------=_Part_2345_2103080339.1454398806093--
------=_Part_2344_1101567846.1454398806092--
.
Author: =?UTF-8?B?7Jyk7ZuI64Ko?= <sim9108@naver.com>
Date: Mon, 1 Feb 2016 23:45:09 -0800 (PST)
Raw View
------=_Part_549_1093166971.1454399109140
Content-Type: multipart/alternative;
boundary="----=_Part_550_642039490.1454399109140"
------=_Part_550_642039490.1454399109140
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
my curried function:=20
https://github.com/sim9108/Study2/blob/master/SDKs/curryFunction.cpp
It is implemented as case 1.
Therefore, depending on a point that is called, it can be used at risk.
2016=EB=85=84 2=EC=9B=94 2=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=A4=
=ED=9B=84 4=EC=8B=9C 40=EB=B6=84 6=EC=B4=88 UTC+9, =EC=9C=A4=ED=9B=88=EB=82=
=A8 =EB=8B=98=EC=9D=98 =EB=A7=90:
>
> #include <iostream>
> #include <string>
> // Move or Copy Check
> struct CheckString {
> std::string data_{ "hello" };
> CheckString() =3D default;
> CheckString(const CheckString& rhs) : data_{ rhs.data_ } {
> std::cout << "copying\n";
> }
>
> CheckString(CheckString&& rhs) : data_{ std::move(rhs.data_) } {
> std::cout << "moving\n";
> }
> };
>
> void f(CheckString a, CheckString b, CheckString c, CheckString d) {
> }
>
> //#case 1
> template<typename... TS>
> auto test(TS&&... ts1) {
> =20
> return [&ts1...](auto&&... args) mutable {
> // error 'TS': parameter pack must be expanded in this context
> // TS type not capture. just value capture.
> return f(std::forward<TS>(ts1)..., std::forward<decltype(args)>(args)...)=
;
> };
> }
>
> //case 2
> template<typename... TS>
> auto test(TS&&... ts1) {
> //error syntax error: missing ']' before '=3D'
> // forward to lambda capture--> using in lambda body
> return[ts...=3D std::forward<TS>(ts1)...](auto&&... args) mutable {
> return f(ts..., std::forward<decltype(args)>(args)...);
> };
> }
>
> // make_lambda function
> auto make_lamba(){
> CheckString ts1, ts2;
> return test(ts1, std::move(ts2));
> }
>
> int main() {
> CheckString arg1, arg2;
> auto fn =3Dmake_lamba();
> fn(arg1, std::move(arg2)); //print error;
> }
>
> In the case of the case 1,
> ts1 is simply a reference.
> Therefore, depending on the time the call is at risk.
> That incomplete forwarding
>
> case 2 is captured by an explicit forwarding.
>
>
> 2016=EB=85=84 2=EC=9B=94 2=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=A4=
=ED=9B=84 3=EC=8B=9C 33=EB=B6=84 24=EC=B4=88 UTC+9, Thiago Macieira =EB=8B=
=98=EC=9D=98 =EB=A7=90:
>>
>> On Monday 01 February 2016 20:03:32 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:=
=20
>> > #include <iostream>=20
>> > #include <string>=20
>> > // Move or Copy Check=20
>> > struct CheckString {=20
>> > std::string data_{ "hello" };=20
>> > CheckString() =3D default;=20
>> > CheckString(const CheckString& rhs) : data_{ rhs.data_ } {=20
>> > std::cout << "copying\n";=20
>> > }=20
>> >=20
>> > CheckString(CheckString&& rhs) : data_{ std::move(rhs.data_) } {=20
>> > std::cout << "moving\n";=20
>> > }=20
>> > };=20
>> >=20
>> > void f(CheckString ts1, CheckString ts2, CheckString arg1, CheckString=
=20
>> > arg2) {=20
>> > }=20
>> >=20
>> > //#case 1=20
>> > template<typename... TS>=20
>> > auto test(TS&&... ts1) {=20
>> > return [&ts1...](auto&&... args) mutable {=20
>> > // error 'TS': parameter pack must be expanded in this context=20
>> > // TS type not capture. just value capture.=20
>> > return f(std::forward<TS>(ts1)...,=20
>> std::forward<decltype(args)>(args)...)=20
>> > };=20
>> > }=20
>>
>> No error here, Clang 3.7, GCC 5.3, ICC 16.0.=20
>>
>> > int main() {=20
>> > CheckString ts1, ts2, arg1, arg2;=20
>> > auto fn =3D test(ts1, std::move(ts2));=20
>> > fn(arg1, std::move(arg2));=20
>> > // ts2, arg2 ->moving=20
>> > // ts1, arg1 ->copying=20
>> > }=20
>> >=20
>> > Something seems to be possible also for other purposes, a variety of=
=20
>> uses.=20
>>
>> Please explain with words what this is supposed to do. And considering=
=20
>> case 1=20
>> works, why do we need cases 2 or 3?=20
>>
>> --=20
>> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org=20
>> Software Architect - Intel Open Source Technology Center=20
>> PGP/GPG: 0x6EF45358; fingerprint:=20
>> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
------=_Part_550_642039490.1454399109140
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><br></div><div>my curried function:=C2=A0<a href=3D"h=
ttps://github.com/sim9108/Study2/blob/master/SDKs/curryFunction.cpp">https:=
//github.com/sim9108/Study2/blob/master/SDKs/curryFunction.cpp</a></div><di=
v><div>It is implemented as case 1.</div><div>Therefore, depending on a poi=
nt that is called, it can be used at risk.</div></div><div><br></div><br><b=
r>2016=EB=85=84 2=EC=9B=94 2=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=A4=
=ED=9B=84 4=EC=8B=9C 40=EB=B6=84 6=EC=B4=88 UTC+9, =EC=9C=A4=ED=9B=88=EB=82=
=A8 =EB=8B=98=EC=9D=98 =EB=A7=90:<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>#include <iostream></div><div>#include <s=
tring></div><div>// Move or Copy Check</div><div>struct CheckString {</d=
iv><div>=C2=A0 =C2=A0 std::string data_{ "hello" };</div><div><sp=
an style=3D"white-space:pre"> </span>CheckString() =3D default;</div><div><=
span style=3D"white-space:pre"> </span>CheckString(const CheckString& r=
hs) : data_{ rhs.data_ } {</div><div><span style=3D"white-space:pre"> </sp=
an>std::cout << "copying\n";</div><div><span style=3D"white=
-space:pre"> </span>}</div><div><br></div><div><span style=3D"white-space:p=
re"> </span>CheckString(CheckString&& rhs) : data_{ std::move(rhs.d=
ata_) } {</div><div><span style=3D"white-space:pre"> </span>std::cout <=
< "moving\n";</div><div><span style=3D"white-space:pre"> </spa=
n>}</div><div>};</div><div><br></div><div>void f(CheckString a, CheckString=
b, CheckString c, CheckString d) {</div><div>}</div><div><br></div><div>//=
#case 1</div><div>template<typename... TS></div><div>auto test(TS&=
;&... ts1) {</div><div>=C2=A0 =C2=A0=C2=A0</div><div><span style=3D"whi=
te-space:pre"> </span>return =C2=A0[&ts1...](auto&&... args) mu=
table {</div><div><span style=3D"white-space:pre"> </span>// error 'TS=
': parameter pack must be expanded in this context</div><div><span styl=
e=3D"white-space:pre"> </span>// TS type not capture. just value capture.<=
/div><div><span style=3D"white-space:pre"> </span>return f(std::forward<=
;TS>(ts1)..., std::forward<decltype(args)>(<wbr>args)...);</div><d=
iv><span style=3D"white-space:pre"> </span>};</div><div>}</div><div><br></d=
iv><div><div>//case 2</div><div>template<typename... TS></div><div>au=
to test(TS&&... ts1) {</div><div><span style=3D"white-space:pre"> <=
/span>//error syntax error: missing ']' before '=3D'</div><=
div><span style=3D"white-space:pre"> </span>// forward to lambda capture--&=
gt; using in lambda body</div><div><span style=3D"white-space:pre"> </span>=
return[ts...=3D std::forward<TS>(ts1)...](<wbr>auto&&... args=
) mutable {</div><div><span style=3D"white-space:pre"> </span>return f(ts.=
..., std::forward<decltype(args)>(<wbr>args)...);</div><div><span styl=
e=3D"white-space:pre"> </span>};</div><div>}</div></div><div><br></div><div=
>// make_lambda function</div><div>auto make_lamba(){</div><div>=C2=A0 =C2=
=A0 CheckString ts1, ts2;</div><div>=C2=A0 =C2=A0 return test(ts1, std::mov=
e(ts2));</div><div>}</div><div><br></div><div>int main() {</div><div><span =
style=3D"white-space:pre"> </span>CheckString arg1, arg2;</div><div>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 auto fn =3Dmake_lamba();</div><div><span style=3D"whit=
e-space:pre"> </span>fn(arg1, std::move(arg2)); //print error;</div><div>}<=
/div><div><br></div><div><div>In the case of the case 1,</div><div>ts1 is s=
imply a reference.</div><div>Therefore, depending on the time the call is a=
t risk.</div><div>That incomplete forwarding</div><div><br></div><div>case =
2 is captured by an explicit forwarding.</div></div><div><br></div><br>2016=
=EB=85=84 2=EC=9B=94 2=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=A4=ED=9B=
=84 3=EC=8B=9C 33=EB=B6=84 24=EC=B4=88 UTC+9, Thiago Macieira =EB=8B=98=EC=
=9D=98 =EB=A7=90:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin=
-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">On Monday 01 Febru=
ary 2016 20:03:32 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:
<br>> #include <iostream>
<br>> #include <string>
<br>> // Move or Copy Check
<br>> struct CheckString {
<br>> std::string data_{ "hello" };
<br>> CheckString() =3D default;
<br>> CheckString(const CheckString& rhs) : data_{ rhs.data_ } {
<br>> std::cout << "copying\n";
<br>> }
<br>>=20
<br>> CheckString(CheckString&& rhs) : data_{ std::move(rhs.data=
_) } {
<br>> std::cout << "moving\n";
<br>> }
<br>> };
<br>>=20
<br>> void f(CheckString ts1, CheckString ts2, CheckString arg1, CheckSt=
ring
<br>> arg2) {
<br>> }
<br>>=20
<br>> //#case 1
<br>> template<typename... TS>
<br>> auto test(TS&&... ts1) {
<br>> return =C2=A0[&ts1...](auto&&... args) mutable {
<br>> // error 'TS': parameter pack must be expanded in this con=
text
<br>> // TS type not capture. just value capture.
<br>> return f(std::forward<TS>(ts1)..., std::forward<decltype(=
args)>(<wbr>args)...)
<br>> };
<br>> }
<br>
<br>No error here, Clang 3.7, GCC 5.3, ICC 16.0.
<br>
<br>> int main() {
<br>> CheckString ts1, ts2, arg1, arg2;
<br>> auto fn =3D test(ts1, std::move(ts2));
<br>> fn(arg1, std::move(arg2));
<br>> // ts2, arg2 ->moving
<br>> // ts1, arg1 ->copying
<br>> }
<br>>=20
<br>> Something seems to be possible also for other purposes, a variety =
of uses.
<br>
<br>Please explain with words what this is supposed to do. And considering =
case 1=20
<br>works, why do we need cases 2 or 3?
<br>
<br>--=20
<br>Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" rel=3D"n=
ofollow" target=3D"_blank" onmousedown=3D"this.href=3D'http://www.googl=
e.com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQjC=
NEswDUBNCNanbu7euhqLn_62FW8ag';return true;" onclick=3D"this.href=3D=
9;http://www.google.com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\=
0751\46usg\75AFQjCNEswDUBNCNanbu7euhqLn_62FW8ag';return true;">macieira=
..info</a> - thiago (AT) <a href=3D"http://kde.org" rel=3D"nofollow" target=
=3D"_blank" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75h=
ttp%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo5_JYG1DowztwAH=
AKs80XSA';return true;" onclick=3D"this.href=3D'http://www.google.c=
om/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo5_=
JYG1DowztwAHAKs80XSA';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></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" 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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />
------=_Part_550_642039490.1454399109140--
------=_Part_549_1093166971.1454399109140--
.
Author: =?UTF-8?B?7Jyk7ZuI64Ko?= <sim9108@naver.com>
Date: Tue, 2 Feb 2016 00:04:19 -0800 (PST)
Raw View
------=_Part_2384_143984032.1454400259099
Content-Type: multipart/alternative;
boundary="----=_Part_2385_1251136035.1454400259099"
------=_Part_2385_1251136035.1454400259099
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
In the case of the case 3,
Necessary, but I do not know the proper example.
As a template, the parameter type, there is a case that has a meaning as a=
=20
type itself.
2016=EB=85=84 2=EC=9B=94 2=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=A4=
=ED=9B=84 3=EC=8B=9C 33=EB=B6=84 24=EC=B4=88 UTC+9, Thiago Macieira =EB=8B=
=98=EC=9D=98 =EB=A7=90:
>
> On Monday 01 February 2016 20:03:32 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:=20
> > #include <iostream>=20
> > #include <string>=20
> > // Move or Copy Check=20
> > struct CheckString {=20
> > std::string data_{ "hello" };=20
> > CheckString() =3D default;=20
> > CheckString(const CheckString& rhs) : data_{ rhs.data_ } {=20
> > std::cout << "copying\n";=20
> > }=20
> >=20
> > CheckString(CheckString&& rhs) : data_{ std::move(rhs.data_) } {=20
> > std::cout << "moving\n";=20
> > }=20
> > };=20
> >=20
> > void f(CheckString ts1, CheckString ts2, CheckString arg1, CheckString=
=20
> > arg2) {=20
> > }=20
> >=20
> > //#case 1=20
> > template<typename... TS>=20
> > auto test(TS&&... ts1) {=20
> > return [&ts1...](auto&&... args) mutable {=20
> > // error 'TS': parameter pack must be expanded in this context=20
> > // TS type not capture. just value capture.=20
> > return f(std::forward<TS>(ts1)...,=20
> std::forward<decltype(args)>(args)...)=20
> > };=20
> > }=20
>
> No error here, Clang 3.7, GCC 5.3, ICC 16.0.=20
>
> > int main() {=20
> > CheckString ts1, ts2, arg1, arg2;=20
> > auto fn =3D test(ts1, std::move(ts2));=20
> > fn(arg1, std::move(arg2));=20
> > // ts2, arg2 ->moving=20
> > // ts1, arg1 ->copying=20
> > }=20
> >=20
> > Something seems to be possible also for other purposes, a variety of=20
> uses.=20
>
> Please explain with words what this is supposed to do. And considering=20
> case 1=20
> works, why do we need cases 2 or 3?=20
>
> --=20
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org=20
> Software Architect - Intel Open Source Technology Center=20
> PGP/GPG: 0x6EF45358; fingerprint:=20
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358=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 https://groups.google.com/a/isocpp.org/group/std-propos=
als/.
------=_Part_2385_1251136035.1454400259099
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>In the case of the case 3,</div><div>Necessary, but I=
do not know the proper example.</div><div>As a template, the parameter typ=
e, there is a case that has a meaning as a type itself.<br></div><br>2016=
=EB=85=84 2=EC=9B=94 2=EC=9D=BC =ED=99=94=EC=9A=94=EC=9D=BC =EC=98=A4=ED=9B=
=84 3=EC=8B=9C 33=EB=B6=84 24=EC=B4=88 UTC+9, Thiago Macieira =EB=8B=98=EC=
=9D=98 =EB=A7=90:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On Monday 01 =
February 2016 20:03:32 =EC=9C=A4=ED=9B=88=EB=82=A8 wrote:
<br>> #include <iostream>
<br>> #include <string>
<br>> // Move or Copy Check
<br>> struct CheckString {
<br>> std::string data_{ "hello" };
<br>> CheckString() =3D default;
<br>> CheckString(const CheckString& rhs) : data_{ rhs.data_ } {
<br>> std::cout << "copying\n";
<br>> }
<br>>=20
<br>> CheckString(CheckString&& rhs) : data_{ std::move(rhs.data=
_) } {
<br>> std::cout << "moving\n";
<br>> }
<br>> };
<br>>=20
<br>> void f(CheckString ts1, CheckString ts2, CheckString arg1, CheckSt=
ring
<br>> arg2) {
<br>> }
<br>>=20
<br>> //#case 1
<br>> template<typename... TS>
<br>> auto test(TS&&... ts1) {
<br>> return =C2=A0[&ts1...](auto&&... args) mutable {
<br>> // error 'TS': parameter pack must be expanded in this con=
text
<br>> // TS type not capture. just value capture.
<br>> return f(std::forward<TS>(ts1)..., std::forward<decltype(=
args)>(<wbr>args)...)
<br>> };
<br>> }
<br>
<br>No error here, Clang 3.7, GCC 5.3, ICC 16.0.
<br>
<br>> int main() {
<br>> CheckString ts1, ts2, arg1, arg2;
<br>> auto fn =3D test(ts1, std::move(ts2));
<br>> fn(arg1, std::move(arg2));
<br>> // ts2, arg2 ->moving
<br>> // ts1, arg1 ->copying
<br>> }
<br>>=20
<br>> Something seems to be possible also for other purposes, a variety =
of uses.
<br>
<br>Please explain with words what this is supposed to do. And considering =
case 1=20
<br>works, why do we need cases 2 or 3?
<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'http://www.goo=
gle.com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQ=
jCNEswDUBNCNanbu7euhqLn_62FW8ag';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';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'http://www.google.com/url?q\7=
5http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo5_JYG1Dowztw=
AHAKs80XSA';return true;" onclick=3D"this.href=3D'http://www.google=
..com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo=
5_JYG1DowztwAHAKs80XSA';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" 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"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />
------=_Part_2385_1251136035.1454400259099--
------=_Part_2384_143984032.1454400259099--
.