Topic: Make std::tuple a language construction


Author: HarD Gamer <rodrigojose690@gmail.com>
Date: Mon, 13 Feb 2017 11:51:41 -0800 (PST)
Raw View
------=_Part_388_1220892692.1487015501103
Content-Type: multipart/alternative;
 boundary="----=_Part_389_1710410118.1487015501103"

------=_Part_389_1710410118.1487015501103
Content-Type: text/plain; charset=UTF-8

All the proposal is on the .html file

--
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/8098acd6-7d23-4d42-be66-c3a5dcdaf71f%40isocpp.org.

------=_Part_389_1710410118.1487015501103
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">All the proposal is on the .html file</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; 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/8098acd6-7d23-4d42-be66-c3a5dcdaf71f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8098acd6-7d23-4d42-be66-c3a5dcdaf71f=
%40isocpp.org</a>.<br />

------=_Part_389_1710410118.1487015501103--

------=_Part_388_1220892692.1487015501103
Content-Type: text/html; charset=US-ASCII; name=Tuples.html
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=Tuples.html
X-Attachment-Id: 76057214-a495-457a-ab56-69310ee70000
Content-ID: <76057214-a495-457a-ab56-69310ee70000>

<!DOCTYPE html>
<html>
 <head>
  <title>Make std::tuple a language construction</title>
  <style>
   body {
    font-family: "Arial"
   }
   code {
    font-family: "Courier New";
    font-size: 14px;
   }
   h4, h1 {
    text-align: center;
    width: 100%;
   }
   b {color: blue}
  </style>
 </head>
 <body>
  <h1>Make std::tuple a language construction</h1>
  <h2>Why that?</h2>
  <p>As C++ now have <b>Structure Binding</b>, why not construct a complete type over <b>SB</b>?</p>
  <h2>First Example</h2>
  <p>The code</p>
  <code>[short, string, double] employeer {1, "Anyone Martin", 3665.55};</code>
  <p>is equivalent to </p>
  <code>std::tuple&lt;short, string, double> employeer {1, "Anyone Martin", 3665.55};</code>
  <p>As can be seen, the sintax for that is simple:</p>
  <code>[<i>type-list</i>] <i>object-name</i> {<i>initializer-list</i>}</code>
  <p>The rules of automatic type deduction still working:</p>
  <code><b>auto</b>[] employeer {1, "Anyone Martin"s, 3665.55}; // ok</code>
  <br><code><b>auto</b>[] employeer; // compile time error</code>
  <h2>Add-ons</h2>
  <h3>Provide a operator[]()</h3>
  <p>This operator can server for accessing positions of the tuple by index,
  if the index is out-of-range the compiler emit a error.</P>
  <code>auto[] employeer {1, "Anyone Martin"s, 3665.55};</code></br><br>
  <code>std::cout &lt;&lt; employeer[0] &lt;&lt; endl; // access the <b>int</b>, prints "1"</code></br>
  <code>std::cout &lt;&lt; employeer[1] &lt;&lt; endl; // access the <b>string</b>, prints "Anyone Martin"</code></br>
  <code>std::cout &lt;&lt; employeer[2] &lt;&lt; endl; // access the <b>double</b>, prints "3665.55"</code></br>
  <code>std::cout &lt;&lt; employeer[3] &lt;&lt; endl; // compile time error: the tuple is only of 3 types</code></br>
  <p>It's also interesting provide a by type access.</P>
  <code>std::cout &lt;&lt; employeer[<b>string</b>] &lt;&lt; endl; // access the <b>string</b>, prints "Anyone Martin"</code></br>
  <code>std::cout &lt;&lt; employeer[<b>wstring</b>] &lt;&lt; endl; // compile time error: there is no a <b>wstring</b> member</code></br>
  <p>And, it can be more interesting.</p>
  <code>std::cout &lt;&lt; employeer[<b>string</b>, 1] &lt;&lt; endl; // access the second <b>string</b>, if has</code></br>
  <h3>Name aliases for members</h3>
  <p>To not depend on the operator[](), it's good provide a way to access the members by a unique name:</p>
  <code>[short <b>as</b> id, string <b>as</b> name, double <b>as</b> salary] employeer;</code></br><br>
  <code>employeer.id = 1;</code></br>
  <code>employeer.name = "Anyone Martin";</code></br>
  <code>employeer.salary = 3665.55;</code></br>
  <p>or</p>
  <code>[short : id, string : name, double : salary] employeer;</code></br><br>
  <p>Is necessary to reserve a new keywork for this?</p>
  <p>Creating a template alias for this can be very easy.</p>
  <code>template&lt;typename StringType = std::string></code><br>
  <code>using Employeer = [short : id, StringType : name, double : salary];</code><br>
  <h3>A operator for swap operations</h3>
  <p>This not only for tuples, it can serve for all C++ types as a replacement for the <b>std::swap</b>,
  and classes member swap functions. As a replacement this operator need to have default implementation
  provided by the compiler.</p>
  <code>auto[] employeer1 {1, "Anyone Martin"s, 3665.55};</code><br>
  <code>auto[] employeer2 {2, "Joana Dark"s, 9563.72};</code><br><br>
  <code>employeer1 <b><=></b> employeer2; // So Simple!!!</code><br>
  <p>Equivalent to</p>
  <code>std::swap(employeer1, employeer2);</code>
  <h4>THE END</h4>
 </body>
</html>
------=_Part_388_1220892692.1487015501103--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 13 Feb 2017 12:39:39 -0800 (PST)
Raw View
------=_Part_1822_884679145.1487018379740
Content-Type: multipart/alternative;
 boundary="----=_Part_1823_1093084974.1487018379740"

------=_Part_1823_1093084974.1487018379740
Content-Type: text/plain; charset=UTF-8

On Monday, February 13, 2017 at 2:51:41 PM UTC-5, HarD Gamer wrote:
>
> All the proposal is on the .html file
>

Can you give a reason why we should have that instead of this
<http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2017/p0536r0.html>? I'm
not a particularly big fan of that feature, but I'd much rather have that
than language-based `tuple`s.

--
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/c7d6526a-c748-4a0e-82d3-b424a11298c7%40isocpp.org.

------=_Part_1823_1093084974.1487018379740
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Monday, February 13, 2017 at 2:51:41 PM UTC-5, HarD Gam=
er 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">All =
the proposal is on the .html file</div></blockquote><div><br>Can you give a=
 reason why we should have that instead of <a href=3D"http://www.open-std.o=
rg/JTC1/SC22/WG21/docs/papers/2017/p0536r0.html">this</a>? I&#39;m not a pa=
rticularly big fan of that feature, but I&#39;d much rather have that than =
language-based `tuple`s.<br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; 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/c7d6526a-c748-4a0e-82d3-b424a11298c7%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c7d6526a-c748-4a0e-82d3-b424a11298c7=
%40isocpp.org</a>.<br />

------=_Part_1823_1093084974.1487018379740--

------=_Part_1822_884679145.1487018379740--

.


Author: HarD Gamer <rodrigojose690@gmail.com>
Date: Tue, 14 Feb 2017 13:12:46 -0800 (PST)
Raw View
------=_Part_2079_263988018.1487106766444
Content-Type: multipart/alternative;
 boundary="----=_Part_2080_393485661.1487106766444"

------=_Part_2080_393485661.1487106766444
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I liked your paper, but Can you think that currentily we can use Structure=
=20
Binding on when we use it with a function return? And, have language-based=
=20
tuple can be util in many places, as for example:

Normal C++:
std::tuple<int, int, int> _3Ints;

auto &first =3D std::get<0>(_3Ints);
auto &second  =3D  std::get<1>(_3Ints);
auto &thirt =3D std::get<2>(_3Ints);

With my proposal:

[=C3=ADnt : first, int : second, int : thirt] _3Ints {1, 2, 3}; // :)
//better than
{=C3=ADnt  first, second, thirt} _3Ints {1, 2, 3}; // OMG, Whay so many=20
{{{{{{{{{{{{{{}}}}}}}}}}}}


Em segunda-feira, 13 de fevereiro de 2017 18:39:39 UTC-2, Nicol Bolas=20
escreveu:
>
> On Monday, February 13, 2017 at 2:51:41 PM UTC-5, HarD Gamer wrote:
>>
>> All the proposal is on the .html file
>>
>
> Can you give a reason why we should have that instead of this=20
> <http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2017/p0536r0.html>?=
=20
> I'm not a particularly big fan of that feature, but I'd much rather have=
=20
> that than language-based `tuple`s.
>

--=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/20860c53-4de8-4c35-a878-f51f4e17d7b9%40isocpp.or=
g.

------=_Part_2080_393485661.1487106766444
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I liked your paper, but Can you think that currentily we c=
an use Structure Binding on when we use it with a function return? And, hav=
e language-based tuple can be util in many places, as for example:<div><br>=
</div><div>Normal C++:</div><div>std::tuple&lt;int, int, int&gt; _3Ints;</d=
iv><div><br></div><div>auto &amp;first =3D std::get&lt;0&gt;(_3Ints);</div>=
<div>auto &amp;second =C2=A0=3D =C2=A0std::get&lt;1&gt;(_3Ints);<br></div><=
div>auto &amp;thirt =3D std::get&lt;2&gt;(_3Ints);<br></div><div><br></div>=
<div>With my proposal:</div><div><br></div><div>[=C3=ADnt : first, int : se=
cond, int : thirt] _3Ints {1, 2, 3}; // :)</div><div>//better than</div><di=
v>{=C3=ADnt =C2=A0first, second, thirt} _3Ints {1, 2, 3}; // OMG, Whay so m=
any {{{{{{{{{{{{{{}}}}}}}}}}}}</div><div><br><br>Em segunda-feira, 13 de fe=
vereiro de 2017 18:39:39 UTC-2, Nicol Bolas  escreveu:<blockquote class=3D"=
gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc so=
lid;padding-left: 1ex;"><div dir=3D"ltr">On Monday, February 13, 2017 at 2:=
51:41 PM UTC-5, HarD Gamer wrote:<blockquote class=3D"gmail_quote" style=3D=
"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><d=
iv dir=3D"ltr">All the proposal is on the .html file</div></blockquote><div=
><br>Can you give a reason why we should have that instead of <a href=3D"ht=
tp://www.open-std.org/JTC1/SC22/WG21/docs/papers/2017/p0536r0.html" target=
=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.goo=
gle.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2FJTC1%2FSC22%2FWG21%2Fdocs%=
2Fpapers%2F2017%2Fp0536r0.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFCd8=
zlHysATNFeXYB5NFbIAtuMEA&#39;;return true;" onclick=3D"this.href=3D&#39;htt=
p://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2FJTC1%2FSC22%2FW=
G21%2Fdocs%2Fpapers%2F2017%2Fp0536r0.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3=
dAFQjCNFCd8zlHysATNFeXYB5NFbIAtuMEA&#39;;return true;">this</a>? I&#39;m no=
t a particularly big fan of that feature, but I&#39;d much rather have that=
 than language-based `tuple`s.<br></div></div></blockquote></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; 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/20860c53-4de8-4c35-a878-f51f4e17d7b9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/20860c53-4de8-4c35-a878-f51f4e17d7b9=
%40isocpp.org</a>.<br />

------=_Part_2080_393485661.1487106766444--

------=_Part_2079_263988018.1487106766444--

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Wed, 15 Feb 2017 00:03:48 +0100
Raw View
Le 13/02/2017 =C3=A0 20:51, HarD Gamer a =C3=A9crit :
> All the proposal is on the .html file


Maybe you will be interested in

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0341r0.html

In particular the pack types and the named pack types are very similar=20
to what you are proposing in your paper ;-)

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/4ba027d2-c5d6-7342-b219-ac62f2e8e825%40wanadoo.f=
r.

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 14 Feb 2017 16:41:36 -0800 (PST)
Raw View
------=_Part_2091_1159942551.1487119296949
Content-Type: multipart/alternative;
 boundary="----=_Part_2092_725217126.1487119296950"

------=_Part_2092_725217126.1487119296950
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Tuesday, February 14, 2017 at 4:12:46 PM UTC-5, HarD Gamer wrote:
>
> I liked your paper,
>

It's not mine.
=20

> but Can you think that currentily we can use Structure Binding on when we=
=20
> use it with a function return?
>

.... huh? I'm confused as to what you're asking.
=20

> And, have language-based tuple can be util in many places, as for example=
:
>
> Normal C++:
> std::tuple<int, int, int> _3Ints;
>
> auto &first =3D std::get<0>(_3Ints);
> auto &second  =3D  std::get<1>(_3Ints);
> auto &thirt =3D std::get<2>(_3Ints);
>

Why would we ever want to do this?

With my proposal:
>
> [=C3=ADnt : first, int : second, int : thirt] _3Ints {1, 2, 3}; // :)
>

Why would we ever want to do that? Is something wrong with

int first =3D 1; int second =3D 2; int third =3D 3;

That seems a lot cleaner and more intuitive. You can even remove some of=20
the typenames:

int first =3D 1, second =3D 2, third =3D 3;

//better than
> {=C3=ADnt  first, second, thirt} _3Ints {1, 2, 3}; // OMG, Whay so many=
=20
> {{{{{{{{{{{{{{}}}}}}}}}}}}
>

That's not what the proposal suggested. The proposal I linked to was about=
=20
returning structs from functions. We already have a way to declare a struct=
:

struct {int first, second, third;} _3Ints{1, 2, 3};

Again, I'd never actually do that, because it's pointless, but it exists=20
presently.

--=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/d3110022-773e-42f8-9cca-54a964c86d9e%40isocpp.or=
g.

------=_Part_2092_725217126.1487119296950
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Tuesday, February 14, 2017 at 4:12:46 PM UTC-5, HarD Ga=
mer 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">I l=
iked your paper,</div></blockquote><div><br>It&#39;s not mine.<br>=C2=A0</d=
iv><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">but Can yo=
u think that currentily we can use Structure Binding on when we use it with=
 a function return?</div></blockquote><div><br>... huh? I&#39;m confused as=
 to what you&#39;re asking.<br>=C2=A0</div><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">And, have language-based tuple can be util in=
 many places, as for example:<div><br></div><div>Normal C++:</div><div>std:=
:tuple&lt;int, int, int&gt; _3Ints;</div><div><br></div><div>auto &amp;firs=
t =3D std::get&lt;0&gt;(_3Ints);</div><div>auto &amp;second =C2=A0=3D =C2=
=A0std::get&lt;1&gt;(_3Ints);<br></div><div>auto &amp;thirt =3D std::get&lt=
;2&gt;(_3Ints);<br></div></div></blockquote><div><br>Why would we ever want=
 to do this?<br><br></div><blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div=
 dir=3D"ltr"><div></div><div></div><div>With my proposal:</div><div><br></d=
iv><div>[=C3=ADnt : first, int : second, int : thirt] _3Ints {1, 2, 3}; // =
:)</div></div></blockquote><div><br>Why would we ever want to do that? Is s=
omething wrong with<br><br><div style=3D"background-color: rgb(250, 250, 25=
0); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1p=
x; overflow-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettyp=
rint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> first </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">1</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> second </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styl=
ed-by-prettify">2</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> third </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">3</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">;</span></div></code></div><br>That seems a lo=
t cleaner and more intuitive. You can even remove some of the typenames:<br=
><br><div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(=
187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: brea=
k-word;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"su=
bprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">int=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> first </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">1</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> second </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by=
-prettify">2</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> third =
</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">3</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">;</span></div></code></div><br></di=
v><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;b=
order-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>//bett=
er than</div><div>{=C3=ADnt =C2=A0first, second, thirt} _3Ints {1, 2, 3}; /=
/ OMG, Whay so many {{{{{{{{{{{{{{}}}}}}}}}}}}</div></div></blockquote><br>=
That&#39;s not what the proposal suggested. The proposal I linked to was ab=
out returning structs from functions. We already have a way to declare a st=
ruct:<br><br><div style=3D"background-color: rgb(250, 250, 250); border-col=
or: rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow-wr=
ap: break-word;" class=3D"prettyprint"><code class=3D"prettyprint"><div cla=
ss=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">struct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </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 s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> first</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> second</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> third</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;}</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> _3Ints</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">{</span><span style=3D"color: #066;" class=3D"styled-by-pretti=
fy">1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #066;" class=3D"styled-by-prettify">2</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" clas=
s=3D"styled-by-prettify">3</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span></div></code></div><br>Again, I&#39;d never actually do =
that, because it&#39;s pointless, but it exists presently.<br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; 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/d3110022-773e-42f8-9cca-54a964c86d9e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d3110022-773e-42f8-9cca-54a964c86d9e=
%40isocpp.org</a>.<br />

------=_Part_2092_725217126.1487119296950--

------=_Part_2091_1159942551.1487119296949--

.


Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Thu, 16 Feb 2017 15:12:21 -0500
Raw View
On 2017-02-13 14:51, HarD Gamer wrote:
>       Provide a operator[]()
>=20
> This operator can server for accessing positions of the tuple by index, i=
f the=20
> index is out-of-range the compiler emit a error.

This is already proposed (and for many more use cases) by
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0535r0.html.

Your proposal (as others have also noted) sounds a lot like a rehash of
features that P0341, P0535 and P0536 explore.

On 2017-02-14 19:41, Nicol Bolas wrote:
> On Tuesday, February 14, 2017 at 4:12:46 PM UTC-5, HarD Gamer wrote:
>> With my proposal:
>>
>> [=C3=ADnt : first, int : second, int : thirt] _3Ints {1, 2, 3}; //=20
>> //better than
>> {=C3=ADnt  first, second, thirt} _3Ints {1, 2, 3}; // OMG, Whay so many=
=20
>> {{{{{{{{{{{{{{}}}}}}}}}}}}
>=20
> That's not what the proposal suggested. The proposal I linked to was abou=
t=20
> returning structs from functions. We already have a way to declare a stru=
ct:
>=20
> struct {int first, second, third;} _3Ints{1, 2, 3};

Indeed. I don't understand=C2=B9 what you have against {}'s vs. []'s, but I
don't see saving a whole seven characters as worth a language feature.

(=C2=B9 ...though, if I had to guess, I'd guess you have some keyboard layo=
ut
that makes {}'s hard to type?)

--=20
Matthew

--=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/58A607A5.6070607%40gmail.com.

.