Topic: For expression and pack indexing
Author: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Date: Fri, 3 Feb 2017 04:03:35 -0800 (PST)
Raw View
------=_Part_546_921433929.1486123415387
Content-Type: multipart/alternative;
boundary="----=_Part_547_2100640006.1486123415387"
------=_Part_547_2100640006.1486123415387
Content-Type: text/plain; charset=UTF-8
I am writing a proposal to use a for loop embedded in an expression as a
pack generator. This would simplify many variadic template related issues
and as a bonus widens the scope of fold expressions to regular containers.
To get a taste of it here is the apply function written with a for
expression.
template<typename F, typename T> decltype(auto) apply(F f, T& tuple)
{
return f(for (size_t IX : range::ints(tuple_size_v<pars>))
std::get<IX>(tuple) ...);
}
The current draft is available here: P0565 Prefix for and postfix indexing
<https://github.com/BengtGustafsson/P0565-Prefix-for-and-postfix-indexing>
Thanks to Matthew Woehlke for discussion both leading to the proposal being
started and for pointing out weaknesses that could be addressed. Note that
this is not to say that he prefers this over his own D0535 proposal.
Please comment. I intend to get this into the Feb 6 mailing unless you find
severe road blocks in the line of thinking.
Bengt
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/6ea7721e-ff20-4a5f-9f32-4fe0d1b3eb1d%40isocpp.org.
------=_Part_547_2100640006.1486123415387
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div>I am writing a proposal to use a for loop embedde=
d in an expression as a pack generator. This would simplify many variadic t=
emplate related issues and as a bonus widens the scope of fold expressions =
to regular containers.</div><div><br></div><div>To get a taste of it here i=
s the apply function written with a for expression.</div><div><br></div><di=
v><div><br></div><div>=C2=A0 =C2=A0 template<typename F, typename T> =
decltype(auto) apply(F f, T& tuple)</div><div>=C2=A0 =C2=A0 {</div><div=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return f(for (size_t IX : range::ints(tuple_si=
ze_v<pars>)) std::get<IX>(tuple) ...);</div><div>=C2=A0 =C2=A0 =
}</div><div><br></div><div>The current draft is available here:=C2=A0<a hre=
f=3D"https://github.com/BengtGustafsson/P0565-Prefix-for-and-postfix-indexi=
ng">P0565 Prefix for and postfix indexing</a><br></div></div><div><br></div=
><div>Thanks to Matthew Woehlke for discussion both leading to the proposal=
being started and for pointing out weaknesses that could be addressed. Not=
e that this is not to say that he prefers this over his own D0535 proposal.=
</div><div><br></div><div>Please comment. I intend to get this into the Feb=
6 mailing unless you find severe road blocks in the line of thinking.</div=
><div><br></div><div>Bengt</div><div><br></div></div>
<p></p>
-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/6ea7721e-ff20-4a5f-9f32-4fe0d1b3eb1d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6ea7721e-ff20-4a5f-9f32-4fe0d1b3eb1d=
%40isocpp.org</a>.<br />
------=_Part_547_2100640006.1486123415387--
------=_Part_546_921433929.1486123415387--
.