Topic: Is there any proposals on providing tuple-like
Author: szollosi.lorand@gmail.com
Date: Fri, 29 Jul 2016 02:25:00 -0700 (PDT)
Raw View
------=_Part_291_1384047006.1469784300142
Content-Type: multipart/alternative;
boundary="----=_Part_292_2132838356.1469784300142"
------=_Part_292_2132838356.1469784300142
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hi,
If this happens, I'd suggest also adding *begin()* and *end()* and *operato=
r++=20
*for enums, for this makes them almost trivial and would allow for=20
range-based *for()* loops over non-sequential enums.
Btw, would the first parameter of std::*enum_element<>* mean value assigned=
=20
or position (or would we have both)?
Thanks,
-lorro
2016. j=C3=BAlius 29., p=C3=A9ntek 10:47:45 UTC+2 id=C5=91pontban Sam Kelle=
tt a k=C3=B6vetkez=C5=91t=20
=C3=ADrta:
>
> I had an idea that is akin to std::tuple_element and std::tuple_size=20
> although it would obviously require compiler magic rather than a library=
=20
> implementation.
>
> An example:
>
> enum class foo {
> bar, baz, quux
> };
>
> static_assert(std::enum_size<foo>::value =3D=3D 3);
> static_assert(std::enum_element<0, foo>::value =3D=3D foo::bar);
> static_assert(std::enum_element<1, foo>::value =3D=3D foo::baz);
> static_assert(std::enum_element<2, foo>::value =3D=3D foo::quux);
>
>
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/a6d55615-d087-45e3-a24f-cdcbb099a951%40isocpp.or=
g.
------=_Part_292_2132838356.1469784300142
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi,<br><br>If this happens, I'd suggest also adding <i=
>begin()</i> and <i>end()</i> and <i>operator++ </i>for enums, for this mak=
es them almost trivial and would allow for range-based <i>for()</i> loops o=
ver non-sequential enums.<br>Btw, would the first parameter of std::<i>enum=
_element<></i> mean value assigned or position (or would we have both=
)?<br><br>Thanks,<br>-lorro<br><br>2016. j=C3=BAlius 29., p=C3=A9ntek 10:47=
:45 UTC+2 id=C5=91pontban Sam Kellett a k=C3=B6vetkez=C5=91t =C3=ADrta:<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><div><div>I =
had an idea that is akin to std::tuple_element and std::tuple_size although=
it would obviously require compiler magic rather than a library implementa=
tion.<br><br></div>An example:<br><br></div>enum class foo {<br></div>=C2=
=A0 bar, baz, quux<br><div>};<br><br></div><div>static_assert(std::enum_siz=
e<<wbr>foo>::value =3D=3D 3);<br>static_assert(std::enum_<wbr>element=
<0, foo>::value =3D=3D foo::bar);<br>static_assert(std::enum_<wbr>ele=
ment<1, foo>::value =3D=3D foo::baz);<br>static_assert(std::enum_<wbr=
>element<2, foo>::value =3D=3D foo::quux);<br><br></div></div>
</blockquote></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/a6d55615-d087-45e3-a24f-cdcbb099a951%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a6d55615-d087-45e3-a24f-cdcbb099a951=
%40isocpp.org</a>.<br />
------=_Part_292_2132838356.1469784300142--
------=_Part_291_1384047006.1469784300142--
.
Author: Sam Kellett <samkellett@gmail.com>
Date: Fri, 29 Jul 2016 10:36:27 +0100
Raw View
--001a1148e21014acbf0538c2fc4c
Content-Type: text/plain; charset=UTF-8
On 29 July 2016 at 10:25, <szollosi.lorand@gmail.com> wrote:
> Hi,
>
> If this happens, I'd suggest also adding *begin()* and *end()* and *operator++
> *for enums, for this makes them almost trivial and would allow for
> range-based *for()* loops over non-sequential enums.
> Btw, would the first parameter of std::*enum_element<>* mean value
> assigned or position (or would we have both)?
>
position, ala std::tuple_element.
--
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/CAHK%2B-Fv8Yx9zQRm2_7a1CKrtJ2MMGYW-H7YsEXpz-c88NKKfcg%40mail.gmail.com.
--001a1148e21014acbf0538c2fc4c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On 29 July 2016 at 10:25, <span dir=3D"ltr"><<a href=
=3D"mailto:szollosi.lorand@gmail.com" target=3D"_blank">szollosi.lorand@gma=
il.com</a>></span> wrote:<br><div class=3D"gmail_extra"><div class=3D"gm=
ail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Hi,<br><br>If th=
is happens, I'd suggest also adding <i>begin()</i> and <i>end()</i> and=
<i>operator++ </i>for enums, for this makes them almost trivial and would =
allow for range-based <i>for()</i> loops over non-sequential enums.<br>Btw,=
would the first parameter of std::<i>enum_element<></i> mean value a=
ssigned or position (or would we have both)?<br></div></blockquote><div><br=
></div><div>position, ala std::tuple_element. <br></div></div></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/CAHK%2B-Fv8Yx9zQRm2_7a1CKrtJ2MMGYW-H7=
YsEXpz-c88NKKfcg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHK%2B-Fv8Yx9z=
QRm2_7a1CKrtJ2MMGYW-H7YsEXpz-c88NKKfcg%40mail.gmail.com</a>.<br />
--001a1148e21014acbf0538c2fc4c--
.
Author: Ricardo Fabiano de Andrade <ricardofabianodeandrade@gmail.com>
Date: Fri, 29 Jul 2016 07:45:17 -0500
Raw View
--94eb2c062936714ff10538c59fda
Content-Type: text/plain; charset=UTF-8
Please take a look at the current proposal for static (compile-time)
reflection:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0194r1.html
Once in the standard you will be able to achieve such functionality by
doing:
using meta_foo = reflexpr(foo); // obtains foo's meta-object (internal)
representation
static_assert(std::meta::get_size_v<meta_foo> == 3);
static_assert(std::meta::reflects_same_v<std::meta::get_element_m<0,
meta_foo>, reflexpr(foo::bar));
static_assert(std::meta::reflects_same_v<std::meta::get_element_m<1, meta_
foo>, reflexpr(foo::baz));
static_assert(std::meta::reflects_same_v<std::meta::get_element_m<2, meta_
foo>, reflexpr(foo::quux));
On Fri, Jul 29, 2016 at 3:47 AM, Sam Kellett <samkellett@gmail.com> wrote:
> I had an idea that is akin to std::tuple_element and std::tuple_size
> although it would obviously require compiler magic rather than a library
> implementation.
>
> An example:
>
> enum class foo {
> bar, baz, quux
> };
>
> static_assert(std::enum_size<foo>::value == 3);
> static_assert(std::enum_element<0, foo>::value == foo::bar);
> static_assert(std::enum_element<1, foo>::value == foo::baz);
> static_assert(std::enum_element<2, foo>::value == foo::quux);
>
> --
> 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/CAHK%2B-Fu051CUsD-u%3D%3DXYA5VmEx9ubJTtVQvnNkJ9_XjVTj7qmQ%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHK%2B-Fu051CUsD-u%3D%3DXYA5VmEx9ubJTtVQvnNkJ9_XjVTj7qmQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
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/CA%2BfGSbPs0r_QYmV1mLV7QBBMhxS-JSfCrN3ZdjGTCg_F4NhXaQ%40mail.gmail.com.
--94eb2c062936714ff10538c59fda
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Please take a look at the current proposal for static (com=
pile-time) reflection:=C2=A0<a href=3D"http://www.open-std.org/jtc1/sc22/wg=
21/docs/papers/2016/p0194r1.html">http://www.open-std.org/jtc1/sc22/wg21/do=
cs/papers/2016/p0194r1.html</a><div>Once in the standard you will be able t=
o achieve such functionality by doing:</div><div><font face=3D"monospace, m=
onospace">using meta_foo =3D reflexpr(foo); // obtains foo's meta-objec=
t (internal) representation</font></div><div><font face=3D"monospace, monos=
pace"><span style=3D"font-size:12.8px">static_assert(std::meta::get_size_v&=
lt;meta_foo</span><span style=3D"font-size:12.8px">> =3D=3D 3);</span><b=
r style=3D"font-size:12.8px"><span style=3D"font-size:12.8px">static_assert=
(</span><span style=3D"font-size:12.8px">std::meta::</span><span style=3D"l=
ine-height:1.1em;color:rgb(0,0,0);background-color:rgb(240,240,240)">reflec=
ts_same_v<</span><span style=3D"font-size:12.8px">std::meta::get_</span>=
<span style=3D"font-size:12.8px">element_m<0, meta_foo>, reflexpr(foo=
::bar));</span></font></div><div><font face=3D"monospace, monospace"><span =
style=3D"font-size:12.8px">static_assert(</span><span style=3D"font-size:12=
..8px">std::meta::</span><span style=3D"line-height:1.1em;color:rgb(0,0,0);b=
ackground-color:rgb(240,240,240)">reflects_same_v<</span><span style=3D"=
font-size:12.8px">std::</span><span style=3D"font-size:12.8px">meta::</span=
><span style=3D"font-size:12.8px">get_</span><span style=3D"font-size:12.8p=
x">element_m<1,=C2=A0</span><span style=3D"font-size:12.8px">meta_</span=
><span style=3D"font-size:12.8px">foo></span><span style=3D"font-size:12=
..8px">, reflexpr(</span><span style=3D"font-size:12.8px">foo::baz));</span>=
</font></div><div><font face=3D"monospace, monospace"><span style=3D"font-s=
ize:12.8px">static_assert(</span><span style=3D"font-size:12.8px">std::meta=
::</span><span style=3D"line-height:1.1em;color:rgb(0,0,0);background-color=
:rgb(240,240,240)">reflects_same_v<</span><span style=3D"font-size:12.8p=
x">std::</span><span style=3D"font-size:12.8px">meta::</span><span style=3D=
"font-size:12.8px">get_</span><span style=3D"font-size:12.8px">element_m<=
;2,=C2=A0</span><span style=3D"font-size:12.8px">meta_</span><span style=3D=
"font-size:12.8px">foo></span><span style=3D"font-size:12.8px">, reflexp=
r(</span><span style=3D"font-size:12.8px">foo::quux));</span></font></div><=
/div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Fri, Jul =
29, 2016 at 3:47 AM, Sam Kellett <span dir=3D"ltr"><<a href=3D"mailto:sa=
mkellett@gmail.com" target=3D"_blank">samkellett@gmail.com</a>></span> w=
rote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><div><div>I h=
ad an idea that is akin to std::tuple_element and std::tuple_size although =
it would obviously require compiler magic rather than a library implementat=
ion.<br><br></div>An example:<br><br></div>enum class foo {<br></div>=C2=A0=
bar, baz, quux<br><div>};<br><br></div><div>static_assert(std::enum_size&l=
t;foo>::value =3D=3D 3);<br>static_assert(std::enum_element<0, foo>=
;::value =3D=3D foo::bar);<br>static_assert(std::enum_element<1, foo>=
::value =3D=3D foo::baz);<br>static_assert(std::enum_element<2, foo>:=
:value =3D=3D foo::quux);<span class=3D"HOEnZb"><font color=3D"#888888"><br=
><br></font></span></div></div><span class=3D"HOEnZb"><font color=3D"#88888=
8">
<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" 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>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAHK%2B-Fu051CUsD-u%3D%3DXYA5VmEx9ubJ=
TtVQvnNkJ9_XjVTj7qmQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Df=
ooter" target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/std=
-proposals/CAHK%2B-Fu051CUsD-u%3D%3DXYA5VmEx9ubJTtVQvnNkJ9_XjVTj7qmQ%40mail=
..gmail.com</a>.<br>
</font></span></blockquote></div><br></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/CA%2BfGSbPs0r_QYmV1mLV7QBBMhxS-JSfCrN=
3ZdjGTCg_F4NhXaQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CA%2BfGSbPs0r_Q=
YmV1mLV7QBBMhxS-JSfCrN3ZdjGTCg_F4NhXaQ%40mail.gmail.com</a>.<br />
--94eb2c062936714ff10538c59fda--
.
Author: Sam Kellett <samkellett@gmail.com>
Date: Fri, 29 Jul 2016 15:35:41 +0100
Raw View
--94eb2c0409b03d29d90538c72a3d
Content-Type: text/plain; charset=UTF-8
On 29 July 2016 at 13:45, Ricardo Fabiano de Andrade <
ricardofabianodeandrade@gmail.com> wrote:
> Please take a look at the current proposal for static (compile-time)
> reflection:
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0194r1.html
> Once in the standard you will be able to achieve such functionality by
> doing:
> using meta_foo = reflexpr(foo); // obtains foo's meta-object (internal)
> representation
> static_assert(std::meta::get_size_v<meta_foo> == 3);
> static_assert(std::meta::reflects_same_v<std::meta::get_element_m<0,
> meta_foo>, reflexpr(foo::bar));
> static_assert(std::meta::reflects_same_v<std::meta::get_element_m<1, meta_
> foo>, reflexpr(foo::baz));
> static_assert(std::meta::reflects_same_v<std::meta::get_element_m<2, meta_
> foo>, reflexpr(foo::quux));
>
> yeah that's all great and all but realistically how far away is that from
being used in production code? if tuple's were allowed introspection
earlier, why not enums too?
--
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/CAHK%2B-FsRq6%2Bv64PePNK44Tn6hX-Xi3NRpUzq%3Dez75KxuML9VcA%40mail.gmail.com.
--94eb2c0409b03d29d90538c72a3d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On 29 July 2016 at 13:45, Ricardo Fabiano de Andrade <span=
dir=3D"ltr"><<a href=3D"mailto:ricardofabianodeandrade@gmail.com" targe=
t=3D"_blank">ricardofabianodeandrade@gmail.com</a>></span> wrote:<br><di=
v class=3D"gmail_extra"><div class=3D"gmail_quote"><blockquote class=3D"gma=
il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef=
t:1ex"><div dir=3D"ltr">Please take a look at the current proposal for stat=
ic (compile-time) reflection:=C2=A0<a href=3D"http://www.open-std.org/jtc1/=
sc22/wg21/docs/papers/2016/p0194r1.html" target=3D"_blank">http://www.open-=
std.org/jtc1/sc22/wg21/docs/papers/2016/p0194r1.html</a><div>Once in the st=
andard you will be able to achieve such functionality by doing:</div><div><=
font face=3D"monospace, monospace">using meta_foo =3D reflexpr(foo); // obt=
ains foo's meta-object (internal) representation</font></div><div><font=
face=3D"monospace, monospace"><span style=3D"font-size:12.8px">static_asse=
rt(std::meta::get_size_v<meta_foo</span><span style=3D"font-size:12.8px"=
>> =3D=3D 3);</span><br style=3D"font-size:12.8px"><span style=3D"font-s=
ize:12.8px">static_assert(</span><span style=3D"font-size:12.8px">std::meta=
::</span><span style=3D"line-height:1.1em;color:rgb(0,0,0);background-color=
:rgb(240,240,240)">reflects_same_v<</span><span style=3D"font-size:12.8p=
x">std::meta::get_</span><span style=3D"font-size:12.8px">element_m<0, m=
eta_foo>, reflexpr(foo::bar));</span></font></div><div><font face=3D"mon=
ospace, monospace"><span style=3D"font-size:12.8px">static_assert(</span><s=
pan style=3D"font-size:12.8px">std::meta::</span><span style=3D"line-height=
:1.1em;color:rgb(0,0,0);background-color:rgb(240,240,240)">reflects_same_v&=
lt;</span><span style=3D"font-size:12.8px">std::</span><span style=3D"font-=
size:12.8px">meta::</span><span style=3D"font-size:12.8px">get_</span><span=
style=3D"font-size:12.8px">element_m<1,=C2=A0</span><span style=3D"font=
-size:12.8px">meta_</span><span style=3D"font-size:12.8px">foo></span><s=
pan style=3D"font-size:12.8px">, reflexpr(</span><span style=3D"font-size:1=
2.8px">foo::baz));</span></font></div><div><font face=3D"monospace, monospa=
ce"><span style=3D"font-size:12.8px">static_assert(</span><span style=3D"fo=
nt-size:12.8px">std::meta::</span><span style=3D"line-height:1.1em;color:rg=
b(0,0,0);background-color:rgb(240,240,240)">reflects_same_v<</span><span=
style=3D"font-size:12.8px">std::</span><span style=3D"font-size:12.8px">me=
ta::</span><span style=3D"font-size:12.8px">get_</span><span style=3D"font-=
size:12.8px">element_m<2,=C2=A0</span><span style=3D"font-size:12.8px">m=
eta_</span><span style=3D"font-size:12.8px">foo></span><span style=3D"fo=
nt-size:12.8px">, reflexpr(</span><span style=3D"font-size:12.8px">foo::quu=
x));</span></font></div></div><span class=3D"">
<p></p></span></blockquote><div>yeah that's all great and all but reali=
stically how far away is that from being used in production code? if tuple&=
#39;s were allowed introspection earlier, why not enums too?<br></div><div>=
=C2=A0</div></div></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/CAHK%2B-FsRq6%2Bv64PePNK44Tn6hX-Xi3NR=
pUzq%3Dez75KxuML9VcA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHK%2B-FsR=
q6%2Bv64PePNK44Tn6hX-Xi3NRpUzq%3Dez75KxuML9VcA%40mail.gmail.com</a>.<br />
--94eb2c0409b03d29d90538c72a3d--
.
Author: Ricardo Fabiano de Andrade <ricardofabianodeandrade@gmail.com>
Date: Fri, 29 Jul 2016 10:28:49 -0500
Raw View
--94eb2c062936486dad0538c7e825
Content-Type: text/plain; charset=UTF-8
There were no core language changes to support obtaining that info from a
tuple.
What you see is just pure meta-programming in action -- of course, with
support of type traits which offers some level of *type* introspection.
What you're asking would certainly require *actual* introspection. That's
what the reflection proposal aims to offer.
And we're not going to get anything before C++20 anyways. By there,
hopefully we're going to have the proposal voted into the standard.
If you want it faster (maybe as a TS), you can always volurteer yourself to
help: https://groups.google.com/a/isocpp.org/forum/#!forum/reflection
On Fri, Jul 29, 2016 at 9:35 AM, Sam Kellett <samkellett@gmail.com> wrote:
> On 29 July 2016 at 13:45, Ricardo Fabiano de Andrade <
> ricardofabianodeandrade@gmail.com> wrote:
>
>> Please take a look at the current proposal for static (compile-time)
>> reflection:
>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0194r1.html
>> Once in the standard you will be able to achieve such functionality by
>> doing:
>> using meta_foo = reflexpr(foo); // obtains foo's meta-object (internal)
>> representation
>> static_assert(std::meta::get_size_v<meta_foo> == 3);
>> static_assert(std::meta::reflects_same_v<std::meta::get_element_m<0,
>> meta_foo>, reflexpr(foo::bar));
>> static_assert(std::meta::reflects_same_v<std::meta::get_element_m<1,
>> meta_foo>, reflexpr(foo::baz));
>> static_assert(std::meta::reflects_same_v<std::meta::get_element_m<2,
>> meta_foo>, reflexpr(foo::quux));
>>
>> yeah that's all great and all but realistically how far away is that from
> being used in production code? if tuple's were allowed introspection
> earlier, why not enums too?
>
>
> --
> 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/CAHK%2B-FsRq6%2Bv64PePNK44Tn6hX-Xi3NRpUzq%3Dez75KxuML9VcA%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHK%2B-FsRq6%2Bv64PePNK44Tn6hX-Xi3NRpUzq%3Dez75KxuML9VcA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
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/CA%2BfGSbP_R8RNWMNo9LM-GPh9DD%2BUjcveX32nhGuqBni4Rc7B8A%40mail.gmail.com.
--94eb2c062936486dad0538c7e825
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">There were no core language changes to support obtaining t=
hat info from a tuple.<div>What you see is just pure meta-programming in ac=
tion -- of course, with support of type traits which offers some level of <=
i>type</i> introspection.<div>What you're asking would certainly requir=
e <i>actual</i> introspection. That's what the reflection proposal aims=
to offer.<br></div><div><br></div><div>And we're not going to get anyt=
hing before C++20 anyways. By there, hopefully we're going to have the =
proposal voted into the standard.</div><div>If you want it faster (maybe as=
a TS), you can always volurteer yourself to help:=C2=A0<a href=3D"https://=
groups.google.com/a/isocpp.org/forum/#!forum/reflection">https://groups.goo=
gle.com/a/isocpp.org/forum/#!forum/reflection</a></div><div><br></div></div=
></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Fri, Ju=
l 29, 2016 at 9:35 AM, Sam Kellett <span dir=3D"ltr"><<a href=3D"mailto:=
samkellett@gmail.com" target=3D"_blank">samkellett@gmail.com</a>></span>=
wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On 29 July 2016 =
at 13:45, Ricardo Fabiano de Andrade <span dir=3D"ltr"><<a href=3D"mailt=
o:ricardofabianodeandrade@gmail.com" target=3D"_blank">ricardofabianodeandr=
ade@gmail.com</a>></span> wrote:<br><div class=3D"gmail_extra"><div clas=
s=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .=
8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Please ta=
ke a look at the current proposal for static (compile-time) reflection:=C2=
=A0<a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0194=
r1.html" target=3D"_blank">http://www.open-std.org/jtc1/sc22/wg21/docs/pape=
rs/2016/p0194r1.html</a><div>Once in the standard you will be able to achie=
ve such functionality by doing:</div><div><font face=3D"monospace, monospac=
e">using meta_foo =3D reflexpr(foo); // obtains foo's meta-object (inte=
rnal) representation</font></div><div><font face=3D"monospace, monospace"><=
span style=3D"font-size:12.8px">static_assert(std::meta::get_size_v<meta=
_foo</span><span style=3D"font-size:12.8px">> =3D=3D 3);</span><br style=
=3D"font-size:12.8px"><span style=3D"font-size:12.8px">static_assert(</span=
><span style=3D"font-size:12.8px">std::meta::</span><span style=3D"line-hei=
ght:1.1em;color:rgb(0,0,0);background-color:rgb(240,240,240)">reflects_same=
_v<</span><span style=3D"font-size:12.8px">std::meta::get_</span><span s=
tyle=3D"font-size:12.8px">element_m<0, meta_foo>, reflexpr(foo::bar))=
;</span></font></div><div><font face=3D"monospace, monospace"><span style=
=3D"font-size:12.8px">static_assert(</span><span style=3D"font-size:12.8px"=
>std::meta::</span><span style=3D"line-height:1.1em;color:rgb(0,0,0);backgr=
ound-color:rgb(240,240,240)">reflects_same_v<</span><span style=3D"font-=
size:12.8px">std::</span><span style=3D"font-size:12.8px">meta::</span><spa=
n style=3D"font-size:12.8px">get_</span><span style=3D"font-size:12.8px">el=
ement_m<1,=C2=A0</span><span style=3D"font-size:12.8px">meta_</span><spa=
n style=3D"font-size:12.8px">foo></span><span style=3D"font-size:12.8px"=
>, reflexpr(</span><span style=3D"font-size:12.8px">foo::baz));</span></fon=
t></div><div><font face=3D"monospace, monospace"><span style=3D"font-size:1=
2.8px">static_assert(</span><span style=3D"font-size:12.8px">std::meta::</s=
pan><span style=3D"line-height:1.1em;color:rgb(0,0,0);background-color:rgb(=
240,240,240)">reflects_same_v<</span><span style=3D"font-size:12.8px">st=
d::</span><span style=3D"font-size:12.8px">meta::</span><span style=3D"font=
-size:12.8px">get_</span><span style=3D"font-size:12.8px">element_m<2,=
=C2=A0</span><span style=3D"font-size:12.8px">meta_</span><span style=3D"fo=
nt-size:12.8px">foo></span><span style=3D"font-size:12.8px">, reflexpr(<=
/span><span style=3D"font-size:12.8px">foo::quux));</span></font></div></di=
v><span>
<p></p></span></blockquote><div>yeah that's all great and all but reali=
stically how far away is that from being used in production code? if tuple&=
#39;s were allowed introspection earlier, why not enums too?<span class=3D"=
HOEnZb"><font color=3D"#888888"><br></font></span></div><span class=3D"HOEn=
Zb"><font color=3D"#888888"><div>=C2=A0</div></font></span></div></div></di=
v><span class=3D"HOEnZb"><font color=3D"#888888">
<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" 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>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAHK%2B-FsRq6%2Bv64PePNK44Tn6hX-Xi3NR=
pUzq%3Dez75KxuML9VcA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Df=
ooter" target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/std=
-proposals/CAHK%2B-FsRq6%2Bv64PePNK44Tn6hX-Xi3NRpUzq%3Dez75KxuML9VcA%40mail=
..gmail.com</a>.<br>
</font></span></blockquote></div><br></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/CA%2BfGSbP_R8RNWMNo9LM-GPh9DD%2BUjcve=
X32nhGuqBni4Rc7B8A%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CA%2BfGSbP_R8=
RNWMNo9LM-GPh9DD%2BUjcveX32nhGuqBni4Rc7B8A%40mail.gmail.com</a>.<br />
--94eb2c062936486dad0538c7e825--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 29 Jul 2016 10:53:21 -0700 (PDT)
Raw View
------=_Part_245_1159451321.1469814801736
Content-Type: multipart/alternative;
boundary="----=_Part_246_924680135.1469814801737"
------=_Part_246_924680135.1469814801737
Content-Type: text/plain; charset=UTF-8
On Friday, July 29, 2016 at 10:35:44 AM UTC-4, Sam Kellett wrote:
>
> On 29 July 2016 at 13:45, Ricardo Fabiano de Andrade <
> ricardofabi...@gmail.com <javascript:>> wrote:
>
>> Please take a look at the current proposal for static (compile-time)
>> reflection:
>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0194r1.html
>> Once in the standard you will be able to achieve such functionality by
>> doing:
>> using meta_foo = reflexpr(foo); // obtains foo's meta-object (internal)
>> representation
>> static_assert(std::meta::get_size_v<meta_foo> == 3);
>> static_assert(std::meta::reflects_same_v<std::meta::get_element_m<0,
>> meta_foo>, reflexpr(foo::bar));
>> static_assert(std::meta::reflects_same_v<std::meta::get_element_m<1,
>> meta_foo>, reflexpr(foo::baz));
>> static_assert(std::meta::reflects_same_v<std::meta::get_element_m<2,
>> meta_foo>, reflexpr(foo::quux));
>>
>> yeah that's all great and all but realistically how far away is that from
> being used in production code?
>
The usual: 3-5 years. But whatever you propose would be 3-5 years too,
since it certainly isn't going into C++17, which is feature complete.
if tuple's were allowed introspection earlier, why not enums too?
>
Because you can't do anything with a tuple without the ability to get a
value from 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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/66d2b19c-defa-4950-923b-a3c8de63ce05%40isocpp.org.
------=_Part_246_924680135.1469814801737
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Friday, July 29, 2016 at 10:35:44 AM UTC-4, Sam=
Kellett 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=
">On 29 July 2016 at 13:45, Ricardo Fabiano de Andrade <span dir=3D"ltr">&l=
t;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"o-GcQW=
PBBQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:';r=
eturn true;" onclick=3D"this.href=3D'javascript:';return true;">ric=
ardofabi...@<wbr>gmail.com</a>></span> wrote:<br><div><div class=3D"gmai=
l_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Please take a look=
at the current proposal for static (compile-time) reflection:=C2=A0<a href=
=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0194r1.html" t=
arget=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://ww=
w.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2F=
docs%2Fpapers%2F2016%2Fp0194r1.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjC=
NFrHd6jf-Qg6Oo6DTvlhYPrhugM8g';return true;" onclick=3D"this.href=3D=
9;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc2=
2%2Fwg21%2Fdocs%2Fpapers%2F2016%2Fp0194r1.html\x26sa\x3dD\x26sntz\x3d1\x26u=
sg\x3dAFQjCNFrHd6jf-Qg6Oo6DTvlhYPrhugM8g';return true;">http://www.open=
-<wbr>std.org/jtc1/sc22/wg21/docs/<wbr>papers/2016/p0194r1.html</a><div>Onc=
e in the standard you will be able to achieve such functionality by doing:<=
/div><div><font face=3D"monospace, monospace">using meta_foo =3D reflexpr(f=
oo); // obtains foo's meta-object (internal) representation</font></div=
><div><font face=3D"monospace, monospace"><span style=3D"font-size:12.8px">=
static_assert(std::meta::get_<wbr>size_v<meta_foo</span><span style=3D"f=
ont-size:12.8px">> =3D=3D 3);</span><br style=3D"font-size:12.8px"><span=
style=3D"font-size:12.8px">static_assert(</span><span style=3D"font-size:1=
2.8px">std::meta::</span><span style=3D"line-height:1.1em;color:rgb(0,0,0);=
background-color:rgb(240,240,240)">refle<wbr>cts_same_v<</span><span sty=
le=3D"font-size:12.8px">std::meta::get_</span><span style=3D"font-size:12.8=
px">elem<wbr>ent_m<0, meta_foo>, reflexpr(foo::bar));</span></font></=
div><div><font face=3D"monospace, monospace"><span style=3D"font-size:12.8p=
x">static_assert(</span><span style=3D"font-size:12.8px">std::meta::</span>=
<span style=3D"line-height:1.1em;color:rgb(0,0,0);background-color:rgb(240,=
240,240)">refle<wbr>cts_same_v<</span><span style=3D"font-size:12.8px">s=
td::</span><span style=3D"font-size:12.8px">meta::</span><span style=3D"fon=
t-size:12.8px">get_</span><span style=3D"font-size:12.8px">elem<wbr>ent_m&l=
t;1,=C2=A0</span><span style=3D"font-size:12.8px">meta_</span><span style=
=3D"font-size:12.8px">foo></span><span style=3D"font-size:12.8px">, refl=
expr(</span><span style=3D"font-size:12.8px">foo::baz));</span></font></div=
><div><font face=3D"monospace, monospace"><span style=3D"font-size:12.8px">=
static_assert(</span><span style=3D"font-size:12.8px">std::meta::</span><sp=
an style=3D"line-height:1.1em;color:rgb(0,0,0);background-color:rgb(240,240=
,240)">refle<wbr>cts_same_v<</span><span style=3D"font-size:12.8px">std:=
:</span><span style=3D"font-size:12.8px">meta::</span><span style=3D"font-s=
ize:12.8px">get_</span><span style=3D"font-size:12.8px">elem<wbr>ent_m<2=
,=C2=A0</span><span style=3D"font-size:12.8px">meta_</span><span style=3D"f=
ont-size:12.8px">foo></span><span style=3D"font-size:12.8px">, reflexpr(=
</span><span style=3D"font-size:12.8px">foo::quux));</span></font></div></d=
iv><span>
<p></p></span></blockquote><div>yeah that's all great and all but reali=
stically how far away is that from being used in production code?</div></di=
v></div></div></blockquote><div><br>The usual: 3-5 years. But whatever you =
propose would be 3-5 years too, since it certainly isn't going into C++=
17, which is feature complete.<br><br></div><blockquote class=3D"gmail_quot=
e" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;paddin=
g-left: 1ex;"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><div>if tupl=
e's were allowed introspection earlier, why not enums too?</div></div><=
/div></div></blockquote><div><br>Because you can't do anything with a t=
uple without the ability to get a value from it.<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/66d2b19c-defa-4950-923b-a3c8de63ce05%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/66d2b19c-defa-4950-923b-a3c8de63ce05=
%40isocpp.org</a>.<br />
------=_Part_246_924680135.1469814801737--
------=_Part_245_1159451321.1469814801736--
.