Topic: Possible to access invented template parameters
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 24 Apr 2013 14:01:59 +0300
Raw View
--089e0129480220809504db193be2
Content-Type: text/plain; charset=ISO-8859-1
On 24 April 2013 13:55, <rob.desbois@gmail.com> wrote:
> As far as I can tell from the wording of N3649, perfect forwarding is not
> currently possible via generic lambdas, as the invented type
> template-parameter names are not accessible:
>
> // utterly contrived example
> template< class T >
> auto make_factory() // using N3638 return type deduction
> {
> return []( auto&&... args ) {
> return std::unique_ptr<T>( new T( std::forward<???>(args)...
> ));
> }
> }
>
> Am I correct in this conclusion?
> If so I'm guessing this wasn't merely an oversight, and is the reason just
> practicality of exposing the invented parameter names?
>
>
>
std::forward<decltype(args)...> or some such?
--
---
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/?hl=en.
--089e0129480220809504db193be2
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 24 April 2013 13:55, <span dir=3D"ltr"><<a href=3D"mailto:ro=
b.desbois@gmail.com" target=3D"_blank">rob.desbois@gmail.com</a>></span>=
wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">As far as I can tell from the wording of N36=
49, perfect forwarding is not currently possible via generic lambdas, as th=
e invented type template-parameter names are not accessible:<div>
<br></div><div>=A0 =A0 // utterly contrived example</div><div>=A0 =A0 templ=
ate< class T ></div><div>=A0 =A0 auto make_factory() // using N3638 r=
eturn type deduction</div><div>=A0 =A0 {</div><div>=A0 =A0 =A0 =A0 return [=
]( auto&&... args ) {</div>
<div>=A0 =A0 =A0 =A0 =A0 =A0 return std::unique_ptr<T>( new T( std::f=
orward<???>(args)... ));</div><div>=A0 =A0 =A0 =A0 }</div><div>=A0 =
=A0 }</div><div><br></div><div>Am I correct in this conclusion?</div><div>I=
f so I'm guessing this wasn't merely an oversight, and is the reaso=
n just practicality of exposing the invented parameter names?</div>
<div><br><br></div></blockquote><div><br></div><div>std::forward<decltyp=
e(args)...> or some such? <br></div></div><br></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--089e0129480220809504db193be2--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 24 Apr 2013 14:04:38 +0300
Raw View
--089e01229c30963b2a04db194445
Content-Type: text/plain; charset=ISO-8859-1
On 24 April 2013 14:01, Ville Voutilainen <ville.voutilainen@gmail.com>wrote:
>
>
>
> On 24 April 2013 13:55, <rob.desbois@gmail.com> wrote:
>
>> As far as I can tell from the wording of N3649, perfect forwarding is not
>> currently possible via generic lambdas, as the invented type
>> template-parameter names are not accessible:
>>
>> // utterly contrived example
>> template< class T >
>> auto make_factory() // using N3638 return type deduction
>> {
>> return []( auto&&... args ) {
>> return std::unique_ptr<T>( new T( std::forward<???>(args)...
>> ));
>> }
>> }
>>
>> Am I correct in this conclusion?
>> If so I'm guessing this wasn't merely an oversight, and is the reason
>> just practicality of exposing the invented parameter names?
>>
>>
>>
> std::forward<decltype(args)...> or some such?
>
>
Ah, the accursed ellipsis and where to put it.
std::forward<decltype(args)>(args)... seems to do it.
--
---
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/?hl=en.
--089e01229c30963b2a04db194445
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 24 April 2013 14:01, Ville Voutilainen <span dir=3D"ltr"><<a =
href=3D"mailto:ville.voutilainen@gmail.com" target=3D"_blank">ville.voutila=
inen@gmail.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><div class=3D"gmail_ext=
ra"><br><br><div class=3D"gmail_quote"><div class=3D"im">On 24 April 2013 1=
3:55, <span dir=3D"ltr"><<a href=3D"mailto:rob.desbois@gmail.com" targe=
t=3D"_blank">rob.desbois@gmail.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">As far as I can tell from the wording of N36=
49, perfect forwarding is not currently possible via generic lambdas, as th=
e invented type template-parameter names are not accessible:<div>
<br></div><div>=A0 =A0 // utterly contrived example</div><div>=A0 =A0 templ=
ate< class T ></div><div>=A0 =A0 auto make_factory() // using N3638 r=
eturn type deduction</div><div>=A0 =A0 {</div><div>=A0 =A0 =A0 =A0 return [=
]( auto&&... args ) {</div>
<div>=A0 =A0 =A0 =A0 =A0 =A0 return std::unique_ptr<T>( new T( std::f=
orward<???>(args)... ));</div><div>=A0 =A0 =A0 =A0 }</div><div>=A0 =
=A0 }</div><div><br></div><div>Am I correct in this conclusion?</div><div>I=
f so I'm guessing this wasn't merely an oversight, and is the reaso=
n just practicality of exposing the invented parameter names?</div>
<div><br><br></div></blockquote><div><br></div></div><div>std::forward<d=
ecltype(args)...> or some such? <br></div></div><br></div></div>
</blockquote></div><br></div><div class=3D"gmail_extra">Ah, the accursed el=
lipsis and where to put it. std::forward<decltype(args)>(args)... see=
ms to do it.<br></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--089e01229c30963b2a04db194445--
.
Author: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@gmail.com>
Date: Wed, 24 Apr 2013 13:04:57 +0200
Raw View
2013/4/24 Ville Voutilainen <ville.voutilainen@gmail.com>:
>
> On 24 April 2013 13:55, <rob.desbois@gmail.com> wrote:
>>
>> As far as I can tell from the wording of N3649, perfect forwarding is not
>> currently possible via generic lambdas, as the invented type
>> template-parameter names are not accessible:
>>
>> // utterly contrived example
>> template< class T >
>> auto make_factory() // using N3638 return type deduction
>> {
>> return []( auto&&... args ) {
>> return std::unique_ptr<T>( new T( std::forward<???>(args)...
>> ));
>> }
>> }
>>
>> Am I correct in this conclusion?
>> If so I'm guessing this wasn't merely an oversight, and is the reason just
>> practicality of exposing the invented parameter names?
>>
>>
> std::forward<decltype(args)...> or some such?
I think this the wrong answer here, because every args is an lvalue in
this context and therefore the decltype() deduction returns an
lvalue-reference.
- Daniel
--
---
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/?hl=en.
.
Author: Martinho Fernandes <martinho.fernandes@gmail.com>
Date: Wed, 24 Apr 2013 13:06:33 +0200
Raw View
--14dae9d70e6e7a794a04db194bef
Content-Type: text/plain; charset=ISO-8859-1
>
>
> I think this the wrong answer here, because every args is an lvalue in
> this context and therefore the decltype() deduction returns an
> lvalue-reference.
>
>
When used with identifiers, decltype returns the type they were declared
with.
--
---
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/?hl=en.
--14dae9d70e6e7a794a04db194bef
Content-Type: text/html; charset=ISO-8859-1
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">
<br>
</div>I think this the wrong answer here, because every args is an lvalue in<br>
this context and therefore the decltype() deduction returns an<br>
lvalue-reference.<br>
<span class=""><font color="#888888"></font></span><br></blockquote></div><br>When used with identifiers, decltype returns the type they were declared with.<br></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en">http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en</a>.<br />
<br />
<br />
--14dae9d70e6e7a794a04db194bef--
.
Author: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@gmail.com>
Date: Wed, 24 Apr 2013 13:13:15 +0200
Raw View
2013/4/24 Martinho Fernandes <martinho.fernandes@gmail.com>:
>>
>> I think this the wrong answer here, because every args is an lvalue in
>> this context and therefore the decltype() deduction returns an
>> lvalue-reference.
>>
>
> When used with identifiers, decltype returns the type they were declared
> with.
Yes, you are right, I was on the wrong track here.
- Daniel
--
---
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/?hl=en.
.
Author: Faisal Vali <faisalv@gmail.com>
Date: Wed, 24 Apr 2013 06:23:13 -0500
Raw View
--90e6ba3fcee31060f604db198773
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Wed, Apr 24, 2013 at 6:13 AM, Daniel Kr=FCgler
<daniel.kruegler@gmail.com>wrote:
> 2013/4/24 Martinho Fernandes <martinho.fernandes@gmail.com>:
> >>
> >> I think this the wrong answer here, because every args is an lvalue in
> >> this context and therefore the decltype() deduction returns an
> >> lvalue-reference.
> >>
> >
> > When used with identifiers, decltype returns the type they were declare=
d
> > with.
>
> Yes, you are right, I was on the wrong track here.
>
As was I, until Ville and Doug showed me the error of my ways (while
discussing this in EWG).
--=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/?hl=3Den.
--90e6ba3fcee31060f604db198773
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><div class=3D"gmail_quote">=
On Wed, Apr 24, 2013 at 6:13 AM, Daniel Kr=FCgler <span dir=3D"ltr"><<a =
href=3D"mailto:daniel.kruegler@gmail.com" target=3D"_blank">daniel.kruegler=
@gmail.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">2013/4/24 Martinho Fernandes <<a href=3D"=
mailto:martinho.fernandes@gmail.com">martinho.fernandes@gmail.com</a>>:<=
br>
<div class=3D"im">>><br>
>> I think this the wrong answer here, because every args is an lvalu=
e in<br>
>> this context and therefore the decltype() deduction returns an<br>
>> lvalue-reference.<br>
>><br>
><br>
> When used with identifiers, decltype returns the type they were declar=
ed<br>
> with.<br>
<br>
</div>Yes, you are right, I was on the wrong track here.<br>
<span class=3D"HOEnZb"></span></blockquote><div><br></div><div>As was I, un=
til Ville and Doug showed me the error of my ways=A0 (while discussing this=
in EWG).<br>=A0<br></div></div></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--90e6ba3fcee31060f604db198773--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 24 Apr 2013 14:36:57 +0300
Raw View
--047d7b47274832880604db19b8ec
Content-Type: text/plain; charset=ISO-8859-1
On 24 April 2013 14:23, Faisal Vali <faisalv@gmail.com> wrote:
> As was I, until Ville and Doug showed me the error of my ways (while
> discussing this in EWG).
>
I thought the decltype works, but didn't think of any lvalueness issues.
Doug clarified that it
actually works correctly. ;)
--
---
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/?hl=en.
--047d7b47274832880604db19b8ec
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 24 April 2013 14:23, Faisal Vali <span dir=3D"ltr"><<a href=
=3D"mailto:faisalv@gmail.com" target=3D"_blank">faisalv@gmail.com</a>></=
span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">As was I, until Ville and D=
oug showed me the error of my ways=A0 (while discussing this in EWG).<br></=
div>
</blockquote><div><br></div><div>I thought the decltype works, but didn'=
;t think of any lvalueness issues. Doug clarified that it<br>actually works=
correctly. ;)<br></div></div><br></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--047d7b47274832880604db19b8ec--
.
Author: Nikolay Ivchenkov <mk.ivchenkov@gmail.com>
Date: Wed, 24 Apr 2013 05:36:42 -0700 (PDT)
Raw View
------=_Part_266_3037551.1366807002454
Content-Type: text/plain; charset=ISO-8859-1
On Wednesday, April 24, 2013 3:01:59 PM UTC+4, Ville Voutilainen wrote:
>
> std::forward<decltype(args)...> or some such?
>
Some people (like me) already prefer to use FORWARD(arg) instead of verbose
notation std::forward<Arg>(arg). In most cases
#define FORWARD(x) static_cast<decltype(x) &&>(x)
provides desirable semantics.
std::forward is helpful when we need a conversion to some specific type
that is not deducible from argument, and, IMO, there is no point to use it
otherwise.
..
--
---
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/?hl=en.
------=_Part_266_3037551.1366807002454
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Wednesday, April 24, 2013 3:01:59 PM UTC+4, Ville Voutilainen wrote:<blo=
ckquote 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>std::forward=
<decltype(args)...<wbr>> or some such? <br></div></div></blockquote><=
div><br>Some people (like me) already prefer to use FORWARD(arg) instead of=
verbose notation std::forward<Arg>(arg). In most cases<br><br> =
#define FORWARD(x) static_cast<decltype(x) &&>(x=
)<br><br>provides desirable semantics.<br><br>std::forward is helpful when =
we need a conversion to some specific type that is not deducible from argum=
ent, and, IMO, there is no point to use it otherwise.<br>.<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_266_3037551.1366807002454--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 24 Apr 2013 16:04:20 +0300
Raw View
--001a11c2ab98b8e6ea04db1af066
Content-Type: text/plain; charset=ISO-8859-1
On 24 April 2013 15:36, Nikolay Ivchenkov <mk.ivchenkov@gmail.com> wrote:
> On Wednesday, April 24, 2013 3:01:59 PM UTC+4, Ville Voutilainen wrote:
>>
>> std::forward<decltype(args)...**> or some such?
>>
>
> Some people (like me) already prefer to use FORWARD(arg) instead of
> verbose notation std::forward<Arg>(arg). In most cases
>
> #define FORWARD(x) static_cast<decltype(x) &&>(x)
>
> provides desirable semantics.
>
> std::forward is helpful when we need a conversion to some specific type
> that is not deducible from argument, and, IMO, there is no point to use it
> otherwise.
>
>
Perhaps we should standardize such a utility.
--
---
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/?hl=en.
--001a11c2ab98b8e6ea04db1af066
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 24 April 2013 15:36, Nikolay Ivchenkov <span dir=3D"ltr"><<a =
href=3D"mailto:mk.ivchenkov@gmail.com" target=3D"_blank">mk.ivchenkov@gmail=
..com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div class=3D"im">On Wednesday, April 24, 20=
13 3:01:59 PM UTC+4, Ville Voutilainen wrote:<blockquote class=3D"gmail_quo=
te" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-=
left:1ex">
<div dir=3D"ltr"><div>std::forward<decltype(args)...<u></u>> or some =
such? <br></div></div></blockquote></div><div><br>Some people (like me) alr=
eady prefer to use FORWARD(arg) instead of verbose notation std::forward<=
;Arg>(arg). In most cases<br>
<br>=A0=A0=A0 #define FORWARD(x) static_cast<decltype(x) &&>(=
x)<br><br>provides desirable semantics.<br><br>std::forward is helpful when=
we need a conversion to some specific type that is not deducible from argu=
ment, and, IMO, there is no point to use it otherwise.<br>
<br></div></blockquote><div><br></div><div>Perhaps we should standardize su=
ch a utility. <br></div></div><br></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--001a11c2ab98b8e6ea04db1af066--
.
Author: Xeo <hivemaster@hotmail.de>
Date: Wed, 24 Apr 2013 06:06:48 -0700 (PDT)
Raw View
------=_Part_86_15065294.1366808808067
Content-Type: text/plain; charset=ISO-8859-1
A macro? I don't think that would be a good idea. And it can't be
implemented without a macro, as you can't just take *only* the function
argument, like, say `std::better_forward(x)` - how would `better_forward`
know the original value category?
On Wednesday, April 24, 2013 3:04:20 PM UTC+2, Ville Voutilainen wrote:
>
>
>
>
> On 24 April 2013 15:36, Nikolay Ivchenkov <mk.ivc...@gmail.com<javascript:>
> > wrote:
>
>> On Wednesday, April 24, 2013 3:01:59 PM UTC+4, Ville Voutilainen wrote:
>>>
>>> std::forward<decltype(args)...**> or some such?
>>>
>>
>> Some people (like me) already prefer to use FORWARD(arg) instead of
>> verbose notation std::forward<Arg>(arg). In most cases
>>
>> #define FORWARD(x) static_cast<decltype(x) &&>(x)
>>
>> provides desirable semantics.
>>
>> std::forward is helpful when we need a conversion to some specific type
>> that is not deducible from argument, and, IMO, there is no point to use it
>> otherwise.
>>
>>
> Perhaps we should standardize such a utility.
>
>
--
---
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/?hl=en.
------=_Part_86_15065294.1366808808067
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
A macro? I don't think that would be a good idea. And it can't be implement=
ed without a macro, as you can't just take *only* the function argument, li=
ke, say `std::better_forward(x)` - how would `better_forward` know the orig=
inal value category?<br><br>On Wednesday, April 24, 2013 3:04:20 PM UTC+2, =
Ville Voutilainen wrote:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div d=
ir=3D"ltr"><br><div><br><br><div class=3D"gmail_quote">On 24 April 2013 15:=
36, Nikolay Ivchenkov <span dir=3D"ltr"><<a href=3D"javascript:" target=
=3D"_blank" gdf-obfuscated-mailto=3D"6oO5yZ8Cb-YJ">mk.ivc...@gmail.com</a>&=
gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div>On Wednesday, April 24, 2013 3:01:59 PM=
UTC+4, Ville Voutilainen wrote:<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>std::forward<decltype(args)...<u></u><wbr>> or =
some such? <br></div></div></blockquote></div><div><br>Some people (like me=
) already prefer to use FORWARD(arg) instead of verbose notation std::forwa=
rd<Arg>(arg). In most cases<br>
<br> #define FORWARD(x) static_cast<decltype(x) &&=
amp;>(x)<br><br>provides desirable semantics.<br><br>std::forward is hel=
pful when we need a conversion to some specific type that is not deducible =
from argument, and, IMO, there is no point to use it otherwise.<br>
<br></div></blockquote><div><br></div><div>Perhaps we should standardize su=
ch a utility. <br></div></div><br></div></div>
</blockquote>
<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_86_15065294.1366808808067--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 24 Apr 2013 16:11:06 +0300
Raw View
--14dae93b5e36e1dd0204db1b08b2
Content-Type: text/plain; charset=ISO-8859-1
On 24 April 2013 16:06, Xeo <hivemaster@hotmail.de> wrote:
> A macro? I don't think that would be a good idea. And it can't be
> implemented without a macro, as you can't just take *only* the
See the "such a" part in what I wrote.
> function argument, like, say `std::better_forward(x)` - how would
> `better_forward` know the original value category?
>
>
Perhaps it can't, if we would be talking about a certain kind of
implementation, rather than the semantics
of what the utility does. Perhaps it needs to be an
implementation-supported utility rather than a pure library.
--
---
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/?hl=en.
--14dae93b5e36e1dd0204db1b08b2
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 24 April 2013 16:06, Xeo <span dir=3D"ltr"><<a href=3D"mailto=
:hivemaster@hotmail.de" target=3D"_blank">hivemaster@hotmail.de</a>></sp=
an> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">A macro? I don't think that would be a g=
ood idea. And it can't be implemented without a macro, as you can't=
just take *only* the </blockquote>
<div><br></div><div>See the "such a" part in what I wrote.<br>=A0=
<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex">function argument, like, say `std:=
:better_forward(x)` - how would `better_forward` know the original value ca=
tegory?<br>
<br></blockquote><div><br></div><div>Perhaps it can't, if we would be t=
alking about a certain kind of implementation, rather than the semantics<br=
>of what the utility does. Perhaps it needs to be an implementation-support=
ed utility rather than a pure library. <br>
</div></div><br></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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--14dae93b5e36e1dd0204db1b08b2--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 24 Apr 2013 06:35:22 -0700 (PDT)
Raw View
------=_Part_4128_31087391.1366810523001
Content-Type: text/plain; charset=ISO-8859-1
On Wednesday, April 24, 2013 6:06:48 AM UTC-7, Xeo wrote:
>
> A macro? I don't think that would be a good idea.
C++ has plenty of standard macros. I'm not in favor of standardizing this
one (though I prefer that to the suggestion of an explicit language
intrinsic or something), but the fact that it's a macro shouldn't be
considered sufficient reasoning to not standardize it.
--
---
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/?hl=en.
------=_Part_4128_31087391.1366810523001
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Wednesday, April 24, 2013 6:06:48 AM UTC-7, Xeo wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;">A macro? I don't think that would be a good ide=
a.</blockquote><div><br>C++ has plenty of standard macros. I'm not in favor=
of standardizing this one (though I prefer that to the suggestion of an ex=
plicit language intrinsic or something), but the fact that it's a macro sho=
uldn't be considered sufficient reasoning to not standardize it.</div><br>
<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_4128_31087391.1366810523001--
.
Author: rob.desbois@gmail.com
Date: Wed, 24 Apr 2013 07:41:02 -0700 (PDT)
Raw View
------=_Part_3921_26257991.1366814462527
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Wednesday, 24 April 2013 12:23:13 UTC+1, faisalv wrote:
>
> On Wed, Apr 24, 2013 at 6:13 AM, Daniel Kr=FCgler <daniel....@gmail.com<j=
avascript:>
> > wrote:
>
>> > When used with identifiers, decltype returns the type they were declar=
ed
>> > with.
>>
>> Yes, you are right, I was on the wrong track here.
>>
>
> As was I, until Ville and Doug showed me the error of my ways (while=20
> discussing this in EWG).
> =20
>
I think that is exactly what had me confused too
Ville's 2nd proposed syntax looks like it'll do the trick.
Thanks all :-)
--rob
--=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/?hl=3Den.
------=_Part_3921_26257991.1366814462527
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Wednesday, 24 April 2013 12:23:13 UTC+1, faisalv wrote:<br><blockquote =
class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1p=
x #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><br><div><div class=3D"gm=
ail_quote">On Wed, Apr 24, 2013 at 6:13 AM, Daniel Kr=FCgler <span dir=3D"l=
tr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
puoLx3TuNPUJ">daniel....@gmail.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div>> When used with identifiers, declty=
pe returns the type they were declared<br>
> with.<br>
<br>
</div>Yes, you are right, I was on the wrong track here.<br>
<span></span></blockquote><div><br></div><div>As was I, until Ville and Dou=
g showed me the error of my ways (while discussing this in EWG).<br>&=
nbsp;<br></div></div></div></div></blockquote><div><br></div><div>I think t=
hat is exactly what had me confused too</div><div>Ville's 2nd proposed synt=
ax looks like it'll do the trick.</div><div><br></div><div>Thanks all :-)</=
div><div>--rob</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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_3921_26257991.1366814462527--
.
Author: Faisal Vali <faisalv@gmail.com>
Date: Wed, 24 Apr 2013 10:12:01 -0500
Raw View
--14dae9340445553c7e04db1cb999
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Since there was initial confusion here on my part, I included the following
example in the wording (N3649) to illustrate the use of std::forward with
variadic auto:
[ Example:
auto glambda =3D [](auto a, auto&& b) { return a < b; };
bool b =3D glambda(3, 3.14); // OK
auto vglambda =3D [](auto printer) {
return [=3D](auto&& ... ts) { // OK: ts is a function parameter pac=
k
printer(std::forward<decltype(ts)>(ts)...); //<-- NOTE this line
return [=3D]() {
printer(ts ...);
};
};
};
auto p =3D vglambda( [](auto v1, auto v2, auto v3)
{ std::cout << v1 << v2 << v3; } );
auto q =3D p(1, 'a', 3.14); // OK: outputs 1a3.14
q(); // OK: outputs 1a3.14
=97 end example]
Faisal Vali
On Wed, Apr 24, 2013 at 9:41 AM, <rob.desbois@gmail.com> wrote:
> On Wednesday, 24 April 2013 12:23:13 UTC+1, faisalv wrote:
>
>
>> On Wed, Apr 24, 2013 at 6:13 AM, Daniel Kr=FCgler <daniel....@gmail.com>=
wrote:
>>
>>> > When used with identifiers, decltype returns the type they were
>>> declared
>>> > with.
>>>
>>> Yes, you are right, I was on the wrong track here.
>>>
>>
>> As was I, until Ville and Doug showed me the error of my ways (while
>> discussing this in EWG).
>>
>>
>
> I think that is exactly what had me confused too
> Ville's 2nd proposed syntax looks like it'll do the trick.
>
> Thanks all :-)
> --rob
>
--=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/?hl=3Den.
--14dae9340445553c7e04db1cb999
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Since there was initial confusion here on my part, I inclu=
ded the following example in the wording (N3649) to illustrate the use of s=
td::forward with variadic auto:<br><br>=A0[ Example:<br>=A0=A0=A0 auto glam=
bda=A0 =3D [](auto a, auto&& b) { return=A0 a < b; };<br>
=A0 bool b =3D glambda(3, 3.14);=A0=A0=A0=A0=A0=A0 // OK<br>=A0 auto vglamb=
da =3D [](auto printer) {<br>=A0=A0=A0=A0 return [=3D](auto&& ... t=
s) {=A0=A0 // OK: ts is a=A0 function parameter pack<br>=A0=A0=A0=A0=A0=A0=
=A0=A0 printer(std::forward<decltype(ts)>(ts)...);=A0 //<-- NOTE t=
his line<br>
=A0=A0=A0=A0=A0=A0=A0=A0 return [=3D]() {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
printer(ts ...);<br>=A0=A0=A0=A0=A0=A0=A0=A0 };<br>=A0=A0=A0=A0 };<br>=A0 =
};<br><br>=A0 auto p =3D vglambda( [](auto v1, auto v2, auto v3)=A0=A0=A0 <=
br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
{ std::cout << v1 << v2 << v3; } );<br>
=A0 auto q =3D p(1, 'a', 3.14);=A0 // OK: outputs 1a3.14<br>=A0 q()=
;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // OK: =
outputs 1a3.14<br>=97 end example]<br></div><div class=3D"gmail_extra"><br =
clear=3D"all"><div>Faisal Vali<br><br></div>
<br><br><div class=3D"gmail_quote">On Wed, Apr 24, 2013 at 9:41 AM, <span =
dir=3D"ltr"><<a href=3D"mailto:rob.desbois@gmail.com" target=3D"_blank">=
rob.desbois@gmail.com</a>></span> wrote:<br><blockquote class=3D"gmail_q=
uote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1e=
x">
On Wednesday, 24 April 2013 12:23:13 UTC+1, faisalv wrote:<div class=3D"im=
"><br><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"><br><div><di=
v class=3D"gmail_quote">
On Wed, Apr 24, 2013 at 6:13 AM, Daniel Kr=FCgler <span dir=3D"ltr"><<a>=
daniel....@gmail.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div>> When used with identifiers, declty=
pe returns the type they were declared<br>
> with.<br>
<br>
</div>Yes, you are right, I was on the wrong track here.<br>
<span></span></blockquote><div><br></div><div>As was I, until Ville and Dou=
g showed me the error of my ways=A0 (while discussing this in EWG).<br>=A0<=
br></div></div></div></div></blockquote><div><br></div></div><div>I think t=
hat is exactly what had me confused too</div>
<div>Ville's 2nd proposed syntax looks like it'll do the trick.</di=
v><div><br></div><div>Thanks all :-)</div><div>--rob</div></blockquote></di=
v><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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--14dae9340445553c7e04db1cb999--
.
Author: rob.desbois@gmail.com
Date: Wed, 24 Apr 2013 08:33:32 -0700 (PDT)
Raw View
------=_Part_217_24773533.1366817612685
Content-Type: text/plain; charset=ISO-8859-1
On Wednesday, 24 April 2013 16:12:01 UTC+1, faisalv wrote:
> Since there was initial confusion here on my part, I included the
> following example in the wording (N3649) to illustrate the use of
> std::forward with variadic auto:
>
Ouch, had to show me up for missing it in the paper didn't you ;-)
Thanks for the pointer -- Rob
--
---
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/?hl=en.
------=_Part_217_24773533.1366817612685
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Wednesday, 24 April 2013 16:12:01 UTC+1, faisalv wrote:<br><blockquote =
class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1p=
x #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Since there was initial c=
onfusion here on my part, I included the following example in the wording (=
N3649) to illustrate the use of std::forward with variadic auto:</div></blo=
ckquote><div> </div><div>Ouch, had to show me up for missing it in the=
paper didn't you ;-)</div><div><br></div><div>Thanks for the pointer -- Ro=
b</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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_217_24773533.1366817612685--
.