Topic: Ideas for extending std::tuple with
Author: =?UTF-8?Q?Micha=C5=82_Dominiak?= <griwes@griwes.info>
Date: Wed, 12 Oct 2016 11:58:32 +0000
Raw View
--001a114e7152efaa0b053ea9b661
Content-Type: text/plain; charset=UTF-8
You can already somewhat do this:
auto get_something() {
struct ret_type { int some_value; };
return ret_type{ 1 };
}
On Wed, Oct 12, 2016 at 1:54 PM 'Johannes Schaub' via ISO C++ Standard -
Future Proposals <std-proposals@isocpp.org> wrote:
> 2016-10-12 13:48 GMT+02:00 Johannes Schaub <schaub.johannes@googlemail.com
> >:
> > Hello all,
> >
> > Using type-tags to access tuple fields is a common technique to access
> > fields by "name"
> >
> > struct position_tag : type<double> { };
> > struct color_tag : type<QColor> { };
> >
> > my_tuple<field<position_tag, color_tag> m;
> >
> > QColor c1 = std::get<color_tag>(m);
> > QColor c2 = std::get<QColor>(m);
> > QColor c3 = std::get<1>(m);
> >
> > I was thinking about extending std::tuple with support for tags. This
> > can be done (i believe) most straight forward with string template
> > arguments, if we would have support for them in the future
> >
> > std::tuple<field<double, "position">, field<QColor, "color">>
> getStop();
> >
> > auto m = getStop();
> > double pos = std::get<"position">(m);
> >
> > An alternative (but uglier) implementation would abuse unnamed struct
> > definitions in template-arguments with the "type" baseclass of above
> > to communicate the type
> >
> > std::tuple<struct : typed<double> { type position; },
> > struct : typed<QColor> { type color; }> getStop();
> >
> > Here, "type" is declared in base-class "typed" as a type-alias for its
> > template-parameter. When tuple sees a parameter has "typed<T>" as a
> > base class, it inherits from it. Therefore you could write
> >
> > auto m = getStop();
> > QColor c = m.color;
> >
> > std::get<N> would cast the unnamed-struct to "struct_type::type",
> > requiring a standard-layout struct (can be tested-for with a
> > type-trait). So the unnamed-struct cannot "escape" to the users of the
> > tuple.
> >
> > What do you think about the two approaches? Are there existing papers
> > about perhaps other techniques?
>
> And, a more important question: Do we need proposals for extending
> std::tuple this way, or would unnamed-struct definitions in function
> return types satisfy this use-case better?
>
> struct { double position; QColor color; } getStop();
>
> auto m = getStop();
> QColor c1 = m.color;
> QColor c2 = std::get<QColor>(m);
> QColor c3 = std::get<1>(m);
>
> Is there any drawback from using this technique over extending
> std::tuple? As far as I'm aware, the generic functions in std:: that
> operate on tuples do so by facilitating std::tuple_size, std::get etc,
> so they could equally work on these one-off structs, right (of course,
> it would need some "built-in" support from the implementation to
> inspect above unnamed struct without the user having to write
> specializations for those tuple traits, I guess?).
>
> --
> 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/CANu6V4W6ahF9QpfwXyb08965XCONdounDV1zf39-OnKNLWq%3DBw%40mail.gmail.com
> .
>
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPCFJdQzWy-38Bvt3XQ9OnhtxBe6VYyvDwh1QU0u2sLdPDkbcQ%40mail.gmail.com.
--001a114e7152efaa0b053ea9b661
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">You can already somewhat do this:<div><br></div><div>auto =
get_something() {<br>=C2=A0 =C2=A0 struct ret_type { int some_value; };<br>=
=C2=A0 =C2=A0 return ret_type{ 1 };<br>}</div></div><br><div class=3D"gmail=
_quote"><div dir=3D"ltr">On Wed, Oct 12, 2016 at 1:54 PM 'Johannes Scha=
ub' via ISO C++ Standard - Future Proposals <<a href=3D"mailto:std-p=
roposals@isocpp.org">std-proposals@isocpp.org</a>> wrote:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex">2016-10-12 13:48 GMT+02:00 Johannes Schaub <<a=
href=3D"mailto:schaub.johannes@googlemail.com" class=3D"gmail_msg" target=
=3D"_blank">schaub.johannes@googlemail.com</a>>:<br class=3D"gmail_msg">
> Hello all,<br class=3D"gmail_msg">
><br class=3D"gmail_msg">
> Using type-tags to access tuple fields is a common technique to access=
<br class=3D"gmail_msg">
> fields by "name"<br class=3D"gmail_msg">
><br class=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0struct position_tag : type<double> { };<br cl=
ass=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0struct color_tag : type<QColor> { };<br class=
=3D"gmail_msg">
><br class=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0my_tuple<field<position_tag, color_tag> m;=
<br class=3D"gmail_msg">
><br class=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0QColor c1 =3D std::get<color_tag>(m);<br clas=
s=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0QColor c2 =3D std::get<QColor>(m);<br class=
=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0QColor c3 =3D std::get<1>(m);<br class=3D"gma=
il_msg">
><br class=3D"gmail_msg">
> I was thinking about extending std::tuple with support for tags. This<=
br class=3D"gmail_msg">
> can be done (i believe) most straight forward with string template<br =
class=3D"gmail_msg">
> arguments, if we would have support for them in the future<br class=3D=
"gmail_msg">
><br class=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0std::tuple<field<double, "position"=
>, field<QColor, "color">> getStop();<br class=3D"gma=
il_msg">
><br class=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0auto m =3D getStop();<br class=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0double pos =3D std::get<"position">=
(m);<br class=3D"gmail_msg">
><br class=3D"gmail_msg">
> An alternative (but uglier) implementation would abuse unnamed struct<=
br class=3D"gmail_msg">
> definitions in template-arguments with the "type" baseclass =
of above<br class=3D"gmail_msg">
> to communicate the type<br class=3D"gmail_msg">
><br class=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0std::tuple<struct : typed<double> { type p=
osition; },<br class=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 struct : typed<QColor> { type color; }> getStop();<br class=
=3D"gmail_msg">
><br class=3D"gmail_msg">
> Here, "type" is declared in base-class "typed" as =
a type-alias for its<br class=3D"gmail_msg">
> template-parameter. When tuple sees a parameter has "typed<T&g=
t;" as a<br class=3D"gmail_msg">
> base class, it inherits from it. Therefore you could write<br class=3D=
"gmail_msg">
><br class=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0auto m =3D getStop();<br class=3D"gmail_msg">
>=C2=A0 =C2=A0 =C2=A0QColor c =3D m.color;<br class=3D"gmail_msg">
><br class=3D"gmail_msg">
> std::get<N> would cast the unnamed-struct to "struct_type::=
type",<br class=3D"gmail_msg">
> requiring a standard-layout struct (can be tested-for with a<br class=
=3D"gmail_msg">
> type-trait). So the unnamed-struct cannot "escape" to the us=
ers of the<br class=3D"gmail_msg">
> tuple.<br class=3D"gmail_msg">
><br class=3D"gmail_msg">
> What do you think about the two approaches? Are there existing papers<=
br class=3D"gmail_msg">
> about perhaps other techniques?<br class=3D"gmail_msg">
<br class=3D"gmail_msg">
And, a more important question: Do we need proposals for extending<br class=
=3D"gmail_msg">
std::tuple this way, or would unnamed-struct definitions in function<br cla=
ss=3D"gmail_msg">
return types satisfy this use-case better?<br class=3D"gmail_msg">
<br class=3D"gmail_msg">
=C2=A0 =C2=A0 struct { double position; QColor color; } getStop();<br class=
=3D"gmail_msg">
<br class=3D"gmail_msg">
=C2=A0 =C2=A0 auto m =3D getStop();<br class=3D"gmail_msg">
=C2=A0 =C2=A0 QColor c1 =3D m.color;<br class=3D"gmail_msg">
=C2=A0 =C2=A0 QColor c2 =3D std::get<QColor>(m);<br class=3D"gmail_ms=
g">
=C2=A0 =C2=A0 QColor c3 =3D std::get<1>(m);<br class=3D"gmail_msg">
<br class=3D"gmail_msg">
Is there any drawback from using this technique over extending<br class=3D"=
gmail_msg">
std::tuple? As far as I'm aware, the generic functions in std:: that<br=
class=3D"gmail_msg">
operate on tuples do so by facilitating std::tuple_size, std::get etc,<br c=
lass=3D"gmail_msg">
so they could equally work on these one-off structs, right (of course,<br c=
lass=3D"gmail_msg">
it would need some "built-in" support from the implementation to<=
br class=3D"gmail_msg">
inspect above unnamed struct without the user having to write<br class=3D"g=
mail_msg">
specializations for those tuple traits, I guess?).<br class=3D"gmail_msg">
<br class=3D"gmail_msg">
--<br class=3D"gmail_msg">
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br class=3D"gmail_msg=
">
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" class=3D"=
gmail_msg" target=3D"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br c=
lass=3D"gmail_msg">
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" class=3D"gmail_msg" target=3D"_blank">std-proposals@isocpp.org</a>.<b=
r class=3D"gmail_msg">
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CANu6V4W6ahF9QpfwXyb08965XCONdounDV1z=
f39-OnKNLWq%3DBw%40mail.gmail.com" rel=3D"noreferrer" class=3D"gmail_msg" t=
arget=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/std-proposa=
ls/CANu6V4W6ahF9QpfwXyb08965XCONdounDV1zf39-OnKNLWq%3DBw%40mail.gmail.com</=
a>.<br class=3D"gmail_msg">
</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/CAPCFJdQzWy-38Bvt3XQ9OnhtxBe6VYyvDwh1=
QU0u2sLdPDkbcQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPCFJdQzWy-38Bvt=
3XQ9OnhtxBe6VYyvDwh1QU0u2sLdPDkbcQ%40mail.gmail.com</a>.<br />
--001a114e7152efaa0b053ea9b661--
.
Author: Simon Brand <simon@codeplay.com>
Date: Wed, 12 Oct 2016 14:13:25 +0100
Raw View
This is a multi-part message in MIME format.
--------------2BD8C0E6104FC85687BB5C0F
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Interesting, is that double.position some special syntax exception, or=20
does it generate an anonymous class with a single public data member=20
with the given type and name? Can that be used with existing classes=20
with no changes?
On 12/10/16 14:09, TONGARI J wrote:
> On Wednesday, October 12, 2016 at 7:48:24 PM UTC+8, Johannes Schaub=20
> wrote:
>
> Hello all,
>
> Using type-tags to access tuple fields is a common technique to
> access
> fields by "name"
>
> struct position_tag : type<double> { };
> struct color_tag : type<QColor> { };
>
> my_tuple<field<position_tag, color_tag> m;
>
> QColor c1 =3D std::get<color_tag>(m);
> QColor c2 =3D std::get<QColor>(m);
> QColor c3 =3D std::get<1>(m);
>
> I was thinking about extending std::tuple with support for tags. This
> can be done (i believe) most straight forward with string template
> arguments, if we would have support for them in the future
>
> std::tuple<field<double, "position">, field<QColor, "color">>
> getStop();
>
> auto m =3D getStop();
> double pos =3D std::get<"position">(m);
>
> An alternative (but uglier) implementation would abuse unnamed struct
> definitions in template-arguments with the "type" baseclass of above
> to communicate the type
>
> std::tuple<struct : typed<double> { type position; },
> struct : typed<QColor> { type color; }>
> getStop();
>
> Here, "type" is declared in base-class "typed" as a type-alias for
> its
> template-parameter. When tuple sees a parameter has "typed<T>" as a
> base class, it inherits from it. Therefore you could write
>
> auto m =3D getStop();
> QColor c =3D m.color;
>
> std::get<N> would cast the unnamed-struct to "struct_type::type",
> requiring a standard-layout struct (can be tested-for with a
> type-trait). So the unnamed-struct cannot "escape" to the users of
> the
> tuple.
>
> What do you think about the two approaches? Are there existing papers
> about perhaps other techniques?
>
>
> I'm not aware of any existing proposal, but some experimental language=20
> features I'm developing will allow you to do this:
>
> |
> std::tuple<double.position,QColor.color>getStop();
> autom =3DgetStop();
> doublepos =3Dm.position;
> QColorc =3Dm.color;
> |
>
> Let me know if you need more detail.
> --=20
> You received this message because you are subscribed to the Google=20
> Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send=20
> an email to std-proposals+unsubscribe@isocpp.org=20
> <mailto:std-proposals+unsubscribe@isocpp.org>.
> To post to this group, send email to std-proposals@isocpp.org=20
> <mailto:std-proposals@isocpp.org>.
> To view this discussion on the web visit=20
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/19048c95-770=
c-4413-b5ff-aa405c389621%40isocpp.org=20
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/19048c95-77=
0c-4413-b5ff-aa405c389621%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>.
--=20
Simon Brand
Staff Software Engineer
Codeplay Software Ltd
Level C, Argyle House, 3 Lady Lawson St, Edinburgh, EH3 9DR
Tel: 0131 466 0503
Fax: 0131 557 6600
Website: http://www.codeplay.com
Twitter: https://twitter.com/codeplaysoft
This email and any attachments may contain confidential and /or privileged =
information and is for use by the addressee only. If you are not the intend=
ed recipient, please notify Codeplay Software Ltd immediately and delete th=
e message from your computer. You may not copy or forward it, or use or dis=
close its contents to any other person. Any views or other information in t=
his message which do not relate to our business are not authorized by Codep=
lay software Ltd, nor does this message form part of any contract unless so=
stated.
As internet communications are capable of data corruption Codeplay Software=
Ltd does not accept any responsibility for any changes made to this messag=
e after it was sent. Please note that Codeplay Software Ltd does not accept=
any liability or responsibility for viruses and it is your responsibility =
to scan any attachments.
Company registered in England and Wales, number: 04567874
Registered office: 81 Linkfield Street, Redhill RH1 6BY
--=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/64afce9d-4eee-0f1e-1112-e5fd5c1d066e%40codeplay.=
com.
--------------2BD8C0E6104FC85687BB5C0F
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
Interesting, is that <tt>double.position </tt>some special syntax
exception, or does it generate an anonymous class with a single
public data member with the given type and name? Can that be used
with existing classes with no changes?<br>
<br>
<div class=3D"moz-cite-prefix">On 12/10/16 14:09, TONGARI J wrote:<br>
</div>
<blockquote
cite=3D"mid:19048c95-770c-4413-b5ff-aa405c389621@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">On Wednesday, October 12, 2016 at 7:48:24 PM UTC+8,
Johannes Schaub wrote:
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Hello
all,
<br>
<br>
Using type-tags to access tuple fields is a common technique
to access
<br>
fields by "name"
<br>
<br>
=C2=A0 =C2=A0 struct position_tag : type<double> { };
<br>
=C2=A0 =C2=A0 struct color_tag : type<QColor> { };
<br>
<br>
=C2=A0 =C2=A0 my_tuple<field<position_tag, color_tag> m;
<br>
<br>
=C2=A0 =C2=A0 QColor c1 =3D std::get<color_tag>(m);
<br>
=C2=A0 =C2=A0 QColor c2 =3D std::get<QColor>(m);
<br>
=C2=A0 =C2=A0 QColor c3 =3D std::get<1>(m);
<br>
<br>
I was thinking about extending std::tuple with support for
tags. This
<br>
can be done (i believe) most straight forward with string
template
<br>
arguments, if we would have support for them in the future
<br>
<br>
=C2=A0 =C2=A0 std::tuple<field<double, "position">,
field<QColor, "color">> getStop();
<br>
<br>
=C2=A0 =C2=A0 auto m =3D getStop();
<br>
=C2=A0 =C2=A0 double pos =3D std::get<"position">(m);
<br>
<br>
An alternative (but uglier) implementation would abuse unnamed
struct
<br>
definitions in template-arguments with the "type" baseclass of
above
<br>
to communicate the type
<br>
<br>
=C2=A0 =C2=A0 std::tuple<struct : typed<double> { type
position; },
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0struct : typed<QColor> { type
color; }> getStop();
<br>
<br>
Here, "type" is declared in base-class "typed" as a type-alias
for its
<br>
template-parameter. When tuple sees a parameter has
"typed<T>" as a
<br>
base class, it inherits from it. Therefore you could write
<br>
<br>
=C2=A0 =C2=A0 auto m =3D getStop();
<br>
=C2=A0 =C2=A0 QColor c =3D m.color;
<br>
<br>
std::get<N> would cast the unnamed-struct to
"struct_type::type",
<br>
requiring a standard-layout struct (can be tested-for with a
<br>
type-trait). So the unnamed-struct cannot "escape" to the
users of the
<br>
tuple.
<br>
<br>
What do you think about the two approaches? Are there existing
papers
<br>
about perhaps other techniques?
<br>
</blockquote>
<div><br>
</div>
<div>I'm not aware of any existing proposal, but some
experimental language features I'm developing will allow you
to do this:</div>
<div><br>
</div>
<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250,
250); border-color: rgb(187, 187, 187); border-style: solid;
border-width: 1px; word-wrap: break-word;"><code
class=3D"prettyprint">
<div class=3D"subprettyprint"><span style=3D"color: #000;"
class=3D"styled-by-prettify">std</span><span style=3D"color=
:
#660;" class=3D"styled-by-prettify">::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">tuple</=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #008;" class=3D"styled-by-prettify">double<=
/span><span
style=3D"color: #660;" class=3D"styled-by-prettify">.</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify">positio=
n</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">QColor<=
/span><span
style=3D"color: #660;" class=3D"styled-by-prettify">.</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify">color</=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify">></s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify"> getSto=
p</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">();</sp=
an></div>
<div class=3D"subprettyprint"><span style=3D"color: #000;"
class=3D"styled-by-prettify"></span><span style=3D"color:
#008;" class=3D"styled-by-prettify">auto</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> m </sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> getSto=
p</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">();</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> <br>
</span><span style=3D"color: #008;"
class=3D"styled-by-prettify">double</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> pos </=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> m</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">.</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify">positio=
n</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"> <br>
</span><span style=3D"color: #606;"
class=3D"styled-by-prettify">QColor</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> c </sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> m</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">.</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify">color</=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
></div>
</code></div>
<div><br>
Let me know if you need more detail.</div>
</div>
-- <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 <a moz-do-not-send=3D"true"
href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+=
unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a moz-do-not-send=3D"true"
href=3D"mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</=
a>.<br>
To view this discussion on the web visit <a
moz-do-not-send=3D"true"
href=3D"https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/19048c=
95-770c-4413-b5ff-aa405c389621%40isocpp.org?utm_medium=3Demail&utm_sour=
ce=3Dfooter">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/1=
9048c95-770c-4413-b5ff-aa405c389621%40isocpp.org</a>.<br>
</blockquote>
<br>
<pre class=3D"moz-signature" cols=3D"72">--=20
Simon Brand
Staff Software Engineer
Codeplay Software Ltd
Level C, Argyle House, 3 Lady Lawson St, Edinburgh, EH3 9DR
Tel: 0131 466 0503
Fax: 0131 557 6600
Website: <a class=3D"moz-txt-link-freetext" href=3D"http://www.codeplay.com=
">http://www.codeplay.com</a>
Twitter: <a class=3D"moz-txt-link-freetext" href=3D"https://twitter.com/cod=
eplaysoft">https://twitter.com/codeplaysoft</a>
This email and any attachments may contain confidential and /or privileged =
information and is for use by the addressee only. If you are not the intend=
ed recipient, please notify Codeplay Software Ltd immediately and delete th=
e message from your computer. You may not copy or forward it, or use or dis=
close its contents to any other person. Any views or other information in t=
his message which do not relate to our business are not authorized by Codep=
lay software Ltd, nor does this message form part of any contract unless so=
stated.
As internet communications are capable of data corruption Codeplay Software=
Ltd does not accept any responsibility for any changes made to this messag=
e after it was sent. Please note that Codeplay Software Ltd does not accept=
any liability or responsibility for viruses and it is your responsibility =
to scan any attachments.
Company registered in England and Wales, number: 04567874
Registered office: 81 Linkfield Street, Redhill RH1 6BY </pre>
</body>
</html>
<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/64afce9d-4eee-0f1e-1112-e5fd5c1d066e%=
40codeplay.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.googl=
e.com/a/isocpp.org/d/msgid/std-proposals/64afce9d-4eee-0f1e-1112-e5fd5c1d06=
6e%40codeplay.com</a>.<br />
--------------2BD8C0E6104FC85687BB5C0F--
.
Author: TONGARI J <tongari95@gmail.com>
Date: Wed, 12 Oct 2016 06:33:22 -0700 (PDT)
Raw View
------=_Part_5746_2065014769.1476279202414
Content-Type: multipart/alternative;
boundary="----=_Part_5747_898357681.1476279202415"
------=_Part_5747_898357681.1476279202415
Content-Type: text/plain; charset=UTF-8
On Wednesday, October 12, 2016 at 9:13:32 PM UTC+8, Simon Brand wrote:
>
> Interesting, is that double.position some special syntax exception, or
> does it generate an anonymous class with a single public data member with
> the given type and name? Can that be used with existing classes with no
> changes?
>
OK, let me explain a little more:
A type like double.position is what I call a "designating type", it's
always incomplete and is only for decomposition purpose.
To use such types with existing templates, changes are needs in
the templates themselves, so does std::tuple.
Actually there are 2 features involved in the example:
- Template declname parameter
- Designating type
Template declname parameters allow you to have declaration names templated,
e.g.
template<class T, declname N>
struct S
{
T N;
};
S<int, ?data> s;
s.data = 0;
Designating type is basically a normal type + a designator, e.g.
template<class T>
struct S;
template<class T, declname N>
struct S<T.N> // decompose the designating type
{
T N;
};
S<int.data> s;
s.data = 0;
S<int> s2; // ok, N is unnamed
You can see it as a syntax sugar, but it's more than that since the
designator can be optional, which is important in cases like std::tuple.
--
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/a171e9c8-5bb1-4761-abdb-aeaf78b7c00d%40isocpp.org.
------=_Part_5747_898357681.1476279202415
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, October 12, 2016 at 9:13:32 PM UTC+8, Simon =
Brand wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
Interesting, is that <tt>double.position </tt>some special syntax
exception, or does it generate an anonymous class with a single
public data member with the given type and name? Can that be used
with existing classes with no changes?<br></div></blockquote><div><br><=
/div><div>OK, let me explain a little more:</div><div><font face=3D"arial, =
sans-serif">A type like </font><span style=3D"font-family: monospace;">doub=
le.position</span><font face=3D"arial, sans-serif"> is what I call a "=
designating type", it's always incomplete and is only for decompos=
ition purpose.<br></font></div><div><font face=3D"arial, sans-serif">To use=
such types with=C2=A0</font>existing templates, changes are=C2=A0needs in =
the=C2=A0templates themselves, so does std::tuple.</div><div><br></div><div=
>Actually there are 2 features involved in the example:</div><div><ul><li>T=
emplate declname parameter<br></li><li>D<span style=3D"font-family: arial, =
sans-serif;">esignating type</span><br></li></ul></div><div>Template declna=
me parameters allow you to have declaration names templated, e.g.</div><div=
><br></div><div class=3D"prettyprint" style=3D"background-color: rgb(250, 2=
50, 250); border-color: rgb(187, 187, 187); border-style: solid; border-wid=
th: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"=
subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">t=
emplate</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><=
;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> declname N</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> S<br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 </span><font color=3D"#000088"><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">T </span></font><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">N</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br><br>S</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">int</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">?</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">data</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> s</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>s</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">data </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">;</span></div></code=
></div><div><br></div><div>D<span style=3D"font-family: arial, sans-serif;"=
>esignating type is basically a normal type + a designator, e.g.</span><br>=
</div><div><span style=3D"font-family: arial, sans-serif;"><br></span></div=
><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); =
border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; w=
ord-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyp=
rint"><span style=3D"color: #008;" class=3D"styled-by-prettify">template</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">></span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> S</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">template</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify"><</span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> declname N</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">></span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> S</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">T</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">N</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #800;" class=3D"styled-by-prettify">// decompose the d=
esignating type</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">{=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0=
=C2=A0 T N</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0<br>S</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">data</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> s</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>s</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">data =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br><br>S</span><span style=3D"color: #080;"=
class=3D"styled-by-prettify"><int></span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> s2</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pret=
tify">// ok, N is unnamed</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br></span></div></code></div><br><div>You can see it as a s=
yntax sugar, but it's more than that since the designator can be option=
al, which is important in cases like std::tuple.</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/a171e9c8-5bb1-4761-abdb-aeaf78b7c00d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a171e9c8-5bb1-4761-abdb-aeaf78b7c00d=
%40isocpp.org</a>.<br />
------=_Part_5747_898357681.1476279202415--
------=_Part_5746_2065014769.1476279202414--
.
Author: =?UTF-8?Q?Micha=C5=82_Dominiak?= <griwes@griwes.info>
Date: Thu, 13 Oct 2016 09:55:12 +0000
Raw View
--001a113fe378b5316b053ebc1bb3
Content-Type: text/plain; charset=UTF-8
How is that different from a structure? (Assuming we get type deduction for
NSDMs, which seems to be much less far fetched than assuming your thing is
going to even pass EWG...)
On Thu, Oct 13, 2016 at 11:50 AM TONGARI J <tongari95@gmail.com> wrote:
> On Thursday, October 13, 2016 at 5:32:02 PM UTC+8, Giovanni Piero Deretta
> wrote:
>
> On Wednesday, October 12, 2016 at 12:48:24 PM UTC+1, Johannes Schaub wrote:
>
> Hello all,
>
> Using type-tags to access tuple fields is a common technique to access
> fields by "name"
>
>
> Two things first: I believe that the current Range proposal has something
> similar already. Second, I think you can declare, but not define, types in
> template arguments.
>
> Finally, I have been (very slowly) working on a proposal about this (which
> ambitiously also covers the 'overload set', 'uniform calling convention',
> 'named arguments', and 'operator dot overloading' design space).
>
> What I have currently is a macro based emulation [1] that allows this:
>
> auto tuple = tup($(foo) = 10, $(bar) = 20);
> assert(tuple.foo == 10);
> assert(tuple.bar == 20);
>
>
> A proper language implementation would use ' .<identifier>' instead of
> '$(identifier)'
>
> [1] https://github.com/gpderetta/libtask/blob/master/tests/q_test.cpp
>
>
> Seems we have some work overlapped ;)
> With my experimental language features + template arg deduction from ctor
> (C++17), this is possible:
> std::tuple tup(.foo = 10, .bar = 20); // deduced to std::tuple<int.foo,
> int.bar>
>
> assert(tuple.foo == 10);
> assert(tuple.bar == 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
> 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/5eeef837-6e0f-4544-b610-0474c6aaa02a%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5eeef837-6e0f-4544-b610-0474c6aaa02a%40isocpp.org?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/CAPCFJdS7iPJumE%3DbHhChwUrrA20n35j1XJs8-DO9HVMaJa2RxA%40mail.gmail.com.
--001a113fe378b5316b053ebc1bb3
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">How is that different from a structure? (Assuming we get t=
ype deduction for NSDMs, which seems to be much less far fetched than assum=
ing your thing is going to even pass EWG...)</div><br><div class=3D"gmail_q=
uote"><div dir=3D"ltr">On Thu, Oct 13, 2016 at 11:50 AM TONGARI J <<a hr=
ef=3D"mailto:tongari95@gmail.com">tongari95@gmail.com</a>> wrote:<br></d=
iv><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left=
:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr" class=3D"gmail_msg">On T=
hursday, October 13, 2016 at 5:32:02 PM UTC+8, Giovanni Piero Deretta wrote=
:<blockquote class=3D"gmail_quote gmail_msg" style=3D"margin:0;margin-left:=
0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr" class=
=3D"gmail_msg">On Wednesday, October 12, 2016 at 12:48:24 PM UTC+1, Johanne=
s Schaub wrote:<blockquote class=3D"gmail_quote gmail_msg" style=3D"margin:=
0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">Hello all,
<br class=3D"gmail_msg">
<br class=3D"gmail_msg">Using type-tags to access tuple fields is a common =
technique to access
<br class=3D"gmail_msg">fields by "name"
<br class=3D"gmail_msg"></blockquote><div class=3D"gmail_msg"><br class=3D"=
gmail_msg">Two things first: I believe that the current Range proposal has =
something similar already. Second, I think you can declare, but not define,=
types in template arguments.<br class=3D"gmail_msg"><br class=3D"gmail_msg=
">Finally, I have been (very slowly) working on a proposal about this (whic=
h ambitiously also covers the 'overload set', 'uniform calling =
convention', 'named arguments', and 'operator dot overloadi=
ng' design space).<br class=3D"gmail_msg"><br class=3D"gmail_msg">What =
I have currently is a macro based emulation [1] that allows this: <br class=
=3D"gmail_msg"><br class=3D"gmail_msg"><span class=3D"gmail_msg">=C2=A0=C2=
=A0 auto</span> tuple =3D <span class=3D"gmail_msg">tup</span>($(foo) =3D <=
span class=3D"gmail_msg">10</span>, $(bar) =3D <span class=3D"gmail_msg">20=
</span>);<br class=3D"gmail_msg"><span class=3D"gmail_msg">=C2=A0=C2=A0 ass=
ert</span>(tuple.<span class=3D"gmail_msg">foo</span> =3D=3D <span class=3D=
"gmail_msg">10</span>);
<br class=3D"gmail_msg">=C2=A0=C2=A0 <span class=3D"gmail_msg">assert</span=
>(tuple.<span class=3D"gmail_msg">bar</span> =3D=3D <span class=3D"gmail_ms=
g">20</span>);<br class=3D"gmail_msg"><br class=3D"gmail_msg"><br class=3D"=
gmail_msg">A proper language implementation would use ' .<identifier=
>' instead of '$(identifier)'<br class=3D"gmail_msg"><br cla=
ss=3D"gmail_msg">[1] <a href=3D"https://github.com/gpderetta/libtask/blob/m=
aster/tests/q_test.cpp" rel=3D"nofollow" class=3D"gmail_msg" target=3D"_bla=
nk">https://github.com/gpderetta/libtask/blob/master/tests/q_test.cpp</a></=
div></div></blockquote><div class=3D"gmail_msg"><br class=3D"gmail_msg"></d=
iv></div><div dir=3D"ltr" class=3D"gmail_msg"><div class=3D"gmail_msg">Seem=
s we have some work overlapped ;)=C2=A0</div><div class=3D"gmail_msg">With =
my experimental language features + template arg deduction from ctor (C++17=
), this is possible:</div><div class=3D"gmail_msg"><div class=3D"m_72420639=
31850003353prettyprint gmail_msg" style=3D"background-color:rgb(250,250,250=
);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wr=
ap:break-word"><code class=3D"m_7242063931850003353prettyprint gmail_msg"><=
div class=3D"m_7242063931850003353subprettyprint gmail_msg"><span style=3D"=
color:#000" class=3D"m_7242063931850003353styled-by-prettify gmail_msg">std=
</span><span style=3D"color:#660" class=3D"m_7242063931850003353styled-by-p=
rettify gmail_msg">::</span><span style=3D"color:#000" class=3D"m_724206393=
1850003353styled-by-prettify gmail_msg">tuple tup</span><span style=3D"colo=
r:#660" class=3D"m_7242063931850003353styled-by-prettify gmail_msg">(.</spa=
n><span style=3D"color:#000" class=3D"m_7242063931850003353styled-by-pretti=
fy gmail_msg">foo </span><span style=3D"color:#660" class=3D"m_724206393185=
0003353styled-by-prettify gmail_msg">=3D</span><span style=3D"color:#000" c=
lass=3D"m_7242063931850003353styled-by-prettify gmail_msg"> </span><span st=
yle=3D"color:#066" class=3D"m_7242063931850003353styled-by-prettify gmail_m=
sg">10</span><span style=3D"color:#660" class=3D"m_7242063931850003353style=
d-by-prettify gmail_msg">,</span><span style=3D"color:#000" class=3D"m_7242=
063931850003353styled-by-prettify gmail_msg"> </span><span style=3D"color:#=
660" class=3D"m_7242063931850003353styled-by-prettify gmail_msg">.</span><s=
pan style=3D"color:#000" class=3D"m_7242063931850003353styled-by-prettify g=
mail_msg">bar </span><span style=3D"color:#660" class=3D"m_7242063931850003=
353styled-by-prettify gmail_msg">=3D</span><span style=3D"color:#000" class=
=3D"m_7242063931850003353styled-by-prettify gmail_msg"> </span><span style=
=3D"color:#066" class=3D"m_7242063931850003353styled-by-prettify gmail_msg"=
>20</span><span style=3D"color:#660" class=3D"m_7242063931850003353styled-b=
y-prettify gmail_msg">);</span><span style=3D"color:#000" class=3D"m_724206=
3931850003353styled-by-prettify gmail_msg"> </span><span style=3D"color:#80=
0" class=3D"m_7242063931850003353styled-by-prettify gmail_msg">// deduced t=
o std::tuple<int.foo, int.bar></span></div></code></div></div></div><=
div dir=3D"ltr" class=3D"gmail_msg"><div class=3D"gmail_msg"><div class=3D"=
m_7242063931850003353prettyprint gmail_msg" style=3D"background-color:rgb(2=
50,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1=
px;word-wrap:break-word"><code class=3D"m_7242063931850003353prettyprint gm=
ail_msg"><div class=3D"m_7242063931850003353subprettyprint gmail_msg"><span=
style=3D"color:#000" class=3D"m_7242063931850003353styled-by-prettify gmai=
l_msg"><br class=3D"gmail_msg"></span><span style=3D"color:#008" class=3D"m=
_7242063931850003353styled-by-prettify gmail_msg">assert</span><span style=
=3D"color:#660" class=3D"m_7242063931850003353styled-by-prettify gmail_msg"=
>(</span><span style=3D"color:#000" class=3D"m_7242063931850003353styled-by=
-prettify gmail_msg">tuple</span><span style=3D"color:#660" class=3D"m_7242=
063931850003353styled-by-prettify gmail_msg">.</span><span style=3D"color:#=
000" class=3D"m_7242063931850003353styled-by-prettify gmail_msg">foo </span=
><span style=3D"color:#660" class=3D"m_7242063931850003353styled-by-prettif=
y gmail_msg">=3D=3D</span><span style=3D"color:#000" class=3D"m_72420639318=
50003353styled-by-prettify gmail_msg"> </span><span style=3D"color:#066" cl=
ass=3D"m_7242063931850003353styled-by-prettify gmail_msg">10</span><span st=
yle=3D"color:#660" class=3D"m_7242063931850003353styled-by-prettify gmail_m=
sg">);</span><span style=3D"color:#000" class=3D"m_7242063931850003353style=
d-by-prettify gmail_msg"><br class=3D"gmail_msg"></span><span style=3D"colo=
r:#008" class=3D"m_7242063931850003353styled-by-prettify gmail_msg">assert<=
/span><span style=3D"color:#660" class=3D"m_7242063931850003353styled-by-pr=
ettify gmail_msg">(</span><span style=3D"color:#000" class=3D"m_72420639318=
50003353styled-by-prettify gmail_msg">tuple</span><span style=3D"color:#660=
" class=3D"m_7242063931850003353styled-by-prettify gmail_msg">.</span><span=
style=3D"color:#000" class=3D"m_7242063931850003353styled-by-prettify gmai=
l_msg">bar </span><span style=3D"color:#660" class=3D"m_7242063931850003353=
styled-by-prettify gmail_msg">=3D=3D</span><span style=3D"color:#000" class=
=3D"m_7242063931850003353styled-by-prettify gmail_msg"> </span><span style=
=3D"color:#066" class=3D"m_7242063931850003353styled-by-prettify gmail_msg"=
>20</span><span style=3D"color:#660" class=3D"m_7242063931850003353styled-b=
y-prettify gmail_msg">);</span></div></code></div></div></div>
<p class=3D"gmail_msg"></p>
-- <br class=3D"gmail_msg">
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br class=3D"gmail_msg=
">
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" class=3D"gm=
ail_msg" target=3D"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br cla=
ss=3D"gmail_msg">
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" class=3D"gmail_msg" target=3D"_blank">std-proposals@isocpp.org</a>.<b=
r class=3D"gmail_msg">
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5eeef837-6e0f-4544-b610-0474c6aaa02a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" class=3D"gmail_msg=
" target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/std-prop=
osals/5eeef837-6e0f-4544-b610-0474c6aaa02a%40isocpp.org</a>.<br class=3D"gm=
ail_msg">
</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/CAPCFJdS7iPJumE%3DbHhChwUrrA20n35j1XJ=
s8-DO9HVMaJa2RxA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPCFJdS7iPJumE=
%3DbHhChwUrrA20n35j1XJs8-DO9HVMaJa2RxA%40mail.gmail.com</a>.<br />
--001a113fe378b5316b053ebc1bb3--
.
Author: Giovanni Piero Deretta <gpderetta@gmail.com>
Date: Thu, 13 Oct 2016 11:06:02 +0100
Raw View
--001a113aa910e0163a053ebc412a
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On 13 Oct 2016 10:55 am, "Micha=C5=82 Dominiak" <griwes@griwes.info> wrote:
>
> How is that different from a structure? (Assuming we get type deduction
for NSDMs, which seems to be much less far fetched than assuming your thing
is going to even pass EWG...)
>
It can be used as part of an expression; it allows, among other things for
named function arguments; doesn't require auto NSDM which has been shot
down already; the generated tuple is introspection friendly (my emulation
even provides a string representation of the field name); it uses the same
syntax as C99 designated initilalizers and can be used to emulate them; it
only requires a well contained language change.
> On Thu, Oct 13, 2016 at 11:50 AM TONGARI J <tongari95@gmail.com> wrote:
>>
>> On Thursday, October 13, 2016 at 5:32:02 PM UTC+8, Giovanni Piero
Deretta wrote:
>>>
>>> On Wednesday, October 12, 2016 at 12:48:24 PM UTC+1, Johannes Schaub
wrote:
>>>>
>>>> Hello all,
>>>>
>>>> Using type-tags to access tuple fields is a common technique to access
>>>> fields by "name"
>>>
>>>
>>> Two things first: I believe that the current Range proposal has
something similar already. Second, I think you can declare, but not define,
types in template arguments.
>>>
>>> Finally, I have been (very slowly) working on a proposal about this
(which ambitiously also covers the 'overload set', 'uniform calling
convention', 'named arguments', and 'operator dot overloading' design
space).
>>>
>>> What I have currently is a macro based emulation [1] that allows this:
>>>
>>> auto tuple =3D tup($(foo) =3D 10, $(bar) =3D 20);
>>> assert(tuple.foo =3D=3D 10);
>>> assert(tuple.bar =3D=3D 20);
>>>
>>>
>>> A proper language implementation would use ' .<identifier>' instead of
'$(identifier)'
>>>
>>> [1] https://github.com/gpderetta/libtask/blob/master/tests/q_test.cpp
>>
>>
>> Seems we have some work overlapped ;)
>> With my experimental language features + template arg deduction from
ctor (C++17), this is possible:
>> std::tuple tup(.foo =3D 10, .bar =3D 20); // deduced to std::tuple<int.f=
oo,
int.bar>
>>
>> assert(tuple.foo =3D=3D 10);
>> assert(tuple.bar =3D=3D 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 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/5eeef837-6e0f-=
4544-b610-0474c6aaa02a%40isocpp.org
..
>
> --
> You received this message because you are subscribed to a topic in the
Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit
https://groups.google.com/a/isocpp.org/d/topic/std-proposals/UWc3QbxVf0c/un=
subscribe
..
> To unsubscribe from this group and all its topics, 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/CAPCFJdS7iPJum=
E%3DbHhChwUrrA20n35j1XJs8-DO9HVMaJa2RxA%40mail.gmail.com
..
--=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/CAL52AatUEyo4CVRSvghBrrE1Zi3f09nTwoHiqv%2BUNj_Fz=
Fic-Q%40mail.gmail.com.
--001a113aa910e0163a053ebc412a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<p dir=3D"ltr"></p>
<p dir=3D"ltr">On 13 Oct 2016 10:55 am, "Micha=C5=82 Dominiak" &l=
t;<a href=3D"mailto:griwes@griwes.info">griwes@griwes.info</a>> wrote:<b=
r>
><br>
> How is that different from a structure? (Assuming we get type deductio=
n for NSDMs, which seems to be much less far fetched than assuming your thi=
ng is going to even pass EWG...)<br>
></p>
<p dir=3D"ltr">It can be used as part of an expression; it allows, among ot=
her things for named function=C2=A0 arguments; doesn't require auto NSD=
M which has been shot down already; the generated tuple is introspection fr=
iendly (my emulation even provides a string representation of the field nam=
e); it uses the same syntax as C99 designated initilalizers and can be used=
to emulate them; it only requires a well contained language change.</p>
<p dir=3D"ltr">> On Thu, Oct 13, 2016 at 11:50 AM TONGARI J <<a href=
=3D"mailto:tongari95@gmail.com">tongari95@gmail.com</a>> wrote:<br>
>><br>
>> On Thursday, October 13, 2016 at 5:32:02 PM UTC+8, Giovanni Piero =
Deretta wrote:<br>
>>><br>
>>> On Wednesday, October 12, 2016 at 12:48:24 PM UTC+1, Johannes =
Schaub wrote:<br>
>>>><br>
>>>> Hello all, <br>
>>>><br>
>>>> Using type-tags to access tuple fields is a common techniq=
ue to access <br>
>>>> fields by "name" <br>
>>><br>
>>><br>
>>> Two things first: I believe that the current Range proposal ha=
s something similar already. Second, I think you can declare, but not defin=
e, types in template arguments.<br>
>>><br>
>>> Finally, I have been (very slowly) working on a proposal about=
this (which ambitiously also covers the 'overload set', 'unifo=
rm calling convention', 'named arguments', and 'operator do=
t overloading' design space).<br>
>>><br>
>>> What I have currently is a macro based emulation [1] that allo=
ws this: <br>
>>><br>
>>> =C2=A0=C2=A0 auto tuple =3D tup($(foo) =3D 10, $(bar) =3D 20);=
<br>
>>> =C2=A0=C2=A0 assert(tuple.foo =3D=3D 10); <br>
>>> =C2=A0=C2=A0 assert(tuple.bar =3D=3D 20);<br>
>>><br>
>>><br>
>>> A proper language implementation would use ' .<identifi=
er>' instead of '$(identifier)'<br>
>>><br>
>>> [1] <a href=3D"https://github.com/gpderetta/libtask/blob/maste=
r/tests/q_test.cpp">https://github.com/gpderetta/libtask/blob/master/tests/=
q_test.cpp</a><br>
>><br>
>><br>
>> Seems we have some work overlapped ;)=C2=A0<br>
>> With my experimental language features + template arg deduction fr=
om ctor (C++17), this is possible:<br>
>> std::tuple tup(.foo =3D 10, .bar =3D 20); // deduced to std::tuple=
<int.foo, int.bar><br>
>><br>
>> assert(tuple.foo =3D=3D 10);<br>
>> assert(tuple.bar =3D=3D 20);<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 <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">=
std-proposals+unsubscribe@isocpp.org</a>.<br>
>><br>
>> To post to this group, send email to <a href=3D"mailto:std-proposa=
ls@isocpp.org">std-proposals@isocpp.org</a>.<br>
>> To view this discussion on the web visit <a href=3D"https://groups=
..google.com/a/isocpp.org/d/msgid/std-proposals/5eeef837-6e0f-4544-b610-0474=
c6aaa02a%40isocpp.org">https://groups.google.com/a/isocpp.org/d/msgid/std-p=
roposals/5eeef837-6e0f-4544-b610-0474c6aaa02a%40isocpp.org</a>.<br>
><br>
> -- <br>
> You received this message because you are subscribed to a topic in the=
Google Groups "ISO C++ Standard - Future Proposals" group.<br>
> To unsubscribe from this topic, visit <a href=3D"https://groups.google=
..com/a/isocpp.org/d/topic/std-proposals/UWc3QbxVf0c/unsubscribe">https://gr=
oups.google.com/a/isocpp.org/d/topic/std-proposals/UWc3QbxVf0c/unsubscribe<=
/a>.<br>
> To unsubscribe from this group and all its topics, send an email to <a=
href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-proposals+unsub=
scribe@isocpp.org</a>.<br>
> To post to this group, send email to <a href=3D"mailto:std-proposals@i=
socpp.org">std-proposals@isocpp.org</a>.<br>
> To view this discussion on the web visit <a href=3D"https://groups.goo=
gle.com/a/isocpp.org/d/msgid/std-proposals/CAPCFJdS7iPJumE%3DbHhChwUrrA20n3=
5j1XJs8-DO9HVMaJa2RxA%40mail.gmail.com">https://groups.google.com/a/isocpp.=
org/d/msgid/std-proposals/CAPCFJdS7iPJumE%3DbHhChwUrrA20n35j1XJs8-DO9HVMaJa=
2RxA%40mail.gmail.com</a>.<br></p>
<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/CAL52AatUEyo4CVRSvghBrrE1Zi3f09nTwoHi=
qv%2BUNj_FzFic-Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAL52AatUEyo4CV=
RSvghBrrE1Zi3f09nTwoHiqv%2BUNj_FzFic-Q%40mail.gmail.com</a>.<br />
--001a113aa910e0163a053ebc412a--
.
Author: John Yates <john@yates-sheets.org>
Date: Thu, 13 Oct 2016 08:12:34 -0400
Raw View
--001a1145e1ca610eda053ebe06e8
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
>
>
> std::tuple<double.position, QColor.color> getStop();
> auto m =3D getStop();
> double pos =3D m.position;
> QColor c =3D m.color;
>
=E2=80=8BJust a wild stab off the top of my head:
enum class MoreReadableTags { dimension, label, success };
std::tuple [
MoreReadableTags
] <unsigned, std::string, bool> =E2=80=8B
=E2=80=8BgetSomething();
auto x =3D getSomething();
if (x.success) {
display(x.dimension, x.label);
}=E2=80=8B
/john
--=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/CAJnXXoj7AQra6ZDQJTVdvNZNoDW2eoP6TrmYwuF47-iO6_r=
cMA%40mail.gmail.com.
--001a1145e1ca610eda053ebe06e8
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote"><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left=
:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div class=
=3D"gmail-m_-5217877428583162992prettyprint" style=3D"background-color:rgb(=
250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:=
1px;word-wrap:break-word"><code class=3D"gmail-m_-5217877428583162992pretty=
print"><div class=3D"gmail-m_-5217877428583162992subprettyprint"><span styl=
e=3D"color:rgb(0,0,0)" class=3D"gmail-m_-5217877428583162992styled-by-prett=
ify"><br>std</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-5=
217877428583162992styled-by-prettify">::</span><span style=3D"color:rgb(0,0=
,0)" class=3D"gmail-m_-5217877428583162992styled-by-prettify">tuple</span><=
span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-5217877428583162992st=
yled-by-prettify"><</span><span style=3D"color:rgb(0,0,136)" class=3D"gm=
ail-m_-5217877428583162992styled-by-prettify">double</span><span style=3D"c=
olor:rgb(102,102,0)" class=3D"gmail-m_-5217877428583162992styled-by-prettif=
y">.</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-5217877428583=
162992styled-by-prettify">position</span><span style=3D"color:rgb(102,102,0=
)" class=3D"gmail-m_-5217877428583162992styled-by-prettify">,</span><span s=
tyle=3D"color:rgb(0,0,0)" class=3D"gmail-m_-5217877428583162992styled-by-pr=
ettify"> </span><span style=3D"color:rgb(102,0,102)" class=3D"gmail-m_-5217=
877428583162992styled-by-prettify">QColor</span><span style=3D"color:rgb(10=
2,102,0)" class=3D"gmail-m_-5217877428583162992styled-by-prettify">.</span>=
<span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-5217877428583162992style=
d-by-prettify">color</span><span style=3D"color:rgb(102,102,0)" class=3D"gm=
ail-m_-5217877428583162992styled-by-prettify">></span><span style=3D"col=
or:rgb(0,0,0)" class=3D"gmail-m_-5217877428583162992styled-by-prettify"> ge=
tStop</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-52178774=
28583162992styled-by-prettify">();</span></div><div class=3D"gmail-m_-52178=
77428583162992subprettyprint"><span style=3D"color:rgb(0,0,0)" class=3D"gma=
il-m_-5217877428583162992styled-by-prettify"></span><span style=3D"color:rg=
b(0,0,136)" class=3D"gmail-m_-5217877428583162992styled-by-prettify">auto</=
span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-5217877428583162992=
styled-by-prettify"> m </span><span style=3D"color:rgb(102,102,0)" class=3D=
"gmail-m_-5217877428583162992styled-by-prettify">=3D</span><span style=3D"c=
olor:rgb(0,0,0)" class=3D"gmail-m_-5217877428583162992styled-by-prettify"> =
getStop</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-521787=
7428583162992styled-by-prettify">();</span><span style=3D"color:rgb(0,0,0)"=
class=3D"gmail-m_-5217877428583162992styled-by-prettify"> <br></span><span=
style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-5217877428583162992styled-b=
y-prettify">double</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_=
-5217877428583162992styled-by-prettify"> pos </span><span style=3D"color:rg=
b(102,102,0)" class=3D"gmail-m_-5217877428583162992styled-by-prettify">=3D<=
/span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-521787742858316299=
2styled-by-prettify"> m</span><span style=3D"color:rgb(102,102,0)" class=3D=
"gmail-m_-5217877428583162992styled-by-prettify">.</span><span style=3D"col=
or:rgb(0,0,0)" class=3D"gmail-m_-5217877428583162992styled-by-prettify">pos=
ition</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-52178774=
28583162992styled-by-prettify">;</span><span style=3D"color:rgb(0,0,0)" cla=
ss=3D"gmail-m_-5217877428583162992styled-by-prettify"> <br></span><span sty=
le=3D"color:rgb(102,0,102)" class=3D"gmail-m_-5217877428583162992styled-by-=
prettify">QColor</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-5=
217877428583162992styled-by-prettify"> c </span><span style=3D"color:rgb(10=
2,102,0)" class=3D"gmail-m_-5217877428583162992styled-by-prettify">=3D</spa=
n><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-5217877428583162992sty=
led-by-prettify"> m</span><span style=3D"color:rgb(102,102,0)" class=3D"gma=
il-m_-5217877428583162992styled-by-prettify">.</span><span style=3D"color:r=
gb(0,0,0)" class=3D"gmail-m_-5217877428583162992styled-by-prettify">color</=
span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-521787742858316=
2992styled-by-prettify">;</span></div></code></div></div></blockquote><div>=
<br></div><div><div class=3D"gmail_default" style=3D"font-family:arial,helv=
etica,sans-serif;display:inline">=E2=80=8BJust a wild stab off the top of m=
y head:</div></div><div><div class=3D"gmail_default" style=3D"font-family:a=
rial,helvetica,sans-serif;display:inline"><br></div></div><div><div class=
=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif;display:=
inline">enum class MoreReadableTags { dimension, label, success };</div></d=
iv><div><div class=3D"gmail_default" style=3D"font-family:arial,helvetica,s=
ans-serif;display:inline">std::tuple [</div><span style=3D"font-family:aria=
l,helvetica,sans-serif">MoreReadableTags</span><div class=3D"gmail_default"=
style=3D"font-family:arial,helvetica,sans-serif;display:inline">] <unsi=
gned, std::string, bool> =E2=80=8B</div>=C2=A0<div class=3D"gmail_defaul=
t" style=3D"font-family:arial,helvetica,sans-serif;display:inline">=E2=80=
=8BgetSomething();</div></div><div><div class=3D"gmail_default" style=3D"fo=
nt-family:arial,helvetica,sans-serif;display:inline">auto x =3D getSomethin=
g();</div></div><div><div class=3D"gmail_default" style=3D"font-family:aria=
l,helvetica,sans-serif;display:inline">if (x.success) {</div></div><div><di=
v class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif;d=
isplay:inline">=C2=A0 =C2=A0 display(x.dimension, x.label);</div></div><div=
><div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-ser=
if;display:inline">}=E2=80=8B</div></div><div><div class=3D"gmail_default" =
style=3D"font-family:arial,helvetica,sans-serif;display:inline"><br></div><=
/div><div><div class=3D"gmail_default" style=3D"font-family:arial,helvetica=
,sans-serif;display:inline">/john</div></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/CAJnXXoj7AQra6ZDQJTVdvNZNoDW2eoP6TrmY=
wuF47-iO6_rcMA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAJnXXoj7AQra6ZDQ=
JTVdvNZNoDW2eoP6TrmYwuF47-iO6_rcMA%40mail.gmail.com</a>.<br />
--001a1145e1ca610eda053ebe06e8--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Thu, 13 Oct 2016 22:54:12 +0200
Raw View
Le 12/10/2016 =C3=A0 13:54, 'Johannes Schaub' via ISO C++ Standard - Future=
=20
Proposals a =C3=A9crit :
> 2016-10-12 13:48 GMT+02:00 Johannes Schaub <schaub.johannes@googlemail.co=
m>:
>
> And, a more important question: Do we need proposals for extending
> std::tuple this way, or would unnamed-struct definitions in function
> return types satisfy this use-case better?
>
> struct { double position; QColor color; } getStop();
>
> auto m =3D getStop();
> QColor c1 =3D m.color;
> QColor c2 =3D std::get<QColor>(m);
> QColor c3 =3D std::get<1>(m);
>
> Is there any drawback from using this technique over extending
> std::tuple? As far as I'm aware, the generic functions in std:: that
> operate on tuples do so by facilitating std::tuple_size, std::get etc,
> so they could equally work on these one-off structs, right (of course,
> it would need some "built-in" support from the implementation to
> inspect above unnamed struct without the user having to write
> specializations for those tuple traits, I guess?).
>
Hi,
See " parameter packs outside of templates" -=20
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0341r0.html
Vicente
--=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/780fca68-3abe-206e-0df1-f038d58b72d2%40wanadoo.f=
r.
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Thu, 13 Oct 2016 22:58:24 +0200
Raw View
This is a multi-part message in MIME format.
--------------89B138E7B4B02BFEC44C6EE3
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 12/10/2016 =C3=A0 21:21, Larry Evans a =C3=A9crit :
>
>>
> What about something similar for variant?
>
> std::variant<double.position,QColor.color>
> var_pos_color=3Dstd::tuple<double>(1.2);
>
> then:
> assert(var_pos_color.position =3D=3D 1.2);
> assert(var_pos_color.color =3D=3D undefined);
> assert(var_pos_color.which =3D=3D position);
>
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0095r1.html
Vicente
--=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/01f7eb55-0a0c-3e17-46cb-275625d1eadf%40wanadoo.f=
r.
--------------89B138E7B4B02BFEC44C6EE3
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 12/10/2016 =C3=A0 21:21, Larry Evans =
a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:bc065abb-acc5-ce9a-2b8a-2c114c2542a2@suddenlink.net"
type=3D"cite"><br>
<blockquote type=3D"cite"><br>
</blockquote>
What about something similar for variant?
<br>
<br>
=C2=A0 std::variant<double.position,QColor.color>
<br>
var_pos_color=3Dstd::tuple<double>(1.2);
<br>
<br>
then:
<br>
=C2=A0 assert(var_pos_color.position =3D=3D 1.2);
<br>
=C2=A0 assert(var_pos_color.color =3D=3D undefined);
<br>
=C2=A0 assert(var_pos_color.which =3D=3D position);
<br>
<br>
</blockquote>
<p><font size=3D"+1">See
<a class=3D"moz-txt-link-freetext" href=3D"http://www.open-std.org/=
jtc1/sc22/wg21/docs/papers/2016/p0095r1.html">http://www.open-std.org/jtc1/=
sc22/wg21/docs/papers/2016/p0095r1.html</a></font></p>
<p><font size=3D"+1"><br>
</font></p>
<p><font size=3D"+1">Vicente</font><br>
</p>
</body>
</html>
<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/01f7eb55-0a0c-3e17-46cb-275625d1eadf%=
40wanadoo.fr?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/01f7eb55-0a0c-3e17-46cb-275625d1eadf=
%40wanadoo.fr</a>.<br />
--------------89B138E7B4B02BFEC44C6EE3--
.