220 24339 <7e08b6c5-853c-471e-b248-a9df7e8e27be@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: [tuple] extracting tuples out of a tuple
Date: Fri, 12 Feb 2016 16:28:12 -0800 (PST)
Lines: 458
Approved: news@gmane.org
Message-ID: <7e08b6c5-853c-471e-b248-a9df7e8e27be@isocpp.org>
References: <CA+wfc1-FFqOJ9OSme_SpJAmGz+cshbMDVi_dLrF1ztbzkTN-WQ@mail.gmail.com> <n9ksdc$4so$1@ger.gmane.org> <CA+wfc18LVMDXhRYhkw0PxeOmPiOoqVteF7V+40EdOOYb2K1snA@mail.gmail.com>
 <n9l3ns$33l$1@ger.gmane.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1234_442185814.1455323292521"
X-Trace: ger.gmane.org 1455323301 7702 80.91.229.3 (13 Feb 2016 00:28:21 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 13 Feb 2016 00:28:21 +0000 (UTC)
Cc: mwoehlke.floss@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDLZJYWNDQIJ34PZWUCRUBDCYD4DM@isocpp.org Sat Feb 13 01:28:16 2016
Return-path: <std-proposals+bncBDLZJYWNDQIJ34PZWUCRUBDCYD4DM@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ig0-f199.google.com ([209.85.213.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDLZJYWNDQIJ34PZWUCRUBDCYD4DM@isocpp.org>)
	id 1aUO4N-0000bt-4I
	for gclcip-std-proposals@m.gmane.org; Sat, 13 Feb 2016 01:28:15 +0100
Original-Received: by mail-ig0-f199.google.com with SMTP id rs1sf75130454igb.3
        for <gclcip-std-proposals@m.gmane.org>; Fri, 12 Feb 2016 16:28:14 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:content-type:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=Tb5buHCWNoPTeWjLjOrudplp69Wga/vDlWf9sR7TOHk=;
        b=UNIzUgb7+YYwByaVDZB4WS49zc9h4xI62PLZsqTYXmP/XHX8V195QdgzwPz0Wgmbdy
         6JzIWCebx11thL19Iei/dF+KpiS/bYRTf1c+dMq4XlOuTMTQVy8ghn4lGW7TOETL+DZ1
         0NyAXK1gpmPAeYjvfw5wCzgB6ZaQKnj1l4k8C5pTCYr603BvZZwwYwh0TK0c9HVyX0Yw
         BiOxiBi/hWkJ22MqRTthMv8C8LbEqW4nneU94UiyODAgEd4nm0imzUpwD9pdkvmNU2Dv
         mC4uc/az7sa9ZlDmMkpQsyrT0vSzFnVjXzO1vN+TkZiA1MxdDt4Xylq9nI+kjawq7Mii
         fNJw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:content-type:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=Tb5buHCWNoPTeWjLjOrudplp69Wga/vDlWf9sR7TOHk=;
        b=wZX16QfQukm+AyzOdOrFKnT0mVoGIMQ2QzpgmFSOCCAnPD0xH8vCz+Iw2kRFW/lX1V
         ew1v7YSm9HQYxZeW+6cf9RPB8pabyAfOMxwOORjaVGyVdMnGa6t1/vdoml7pQl7Cj6s+
         pJxFzK0GKBI0SY/Wv2HL5TzA7DRr1Bfn7s0LxBFvsYy6cB40gyXuPiKIVd0rs6Yao563
         TLsY/WPoD5t7W9LEagIVUh464yIWBBl58fTun6yIwYhoeh2+Az+MTsX6CCzkPnwkZiND
         8MJK9aWTYjvbMc3pLnYNrIx8IF18BjH3rUTqAu8WrkqY3zwglghffKjxc8P6US1WapAG
         qWcw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:content-type:x-original-sender
         :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=Tb5buHCWNoPTeWjLjOrudplp69Wga/vDlWf9sR7TOHk=;
        b=mhNp+q0a17MMpnnfwYn6TVkvws9R53zyR7RGBBibLTkV+hm08V1qneHI9iSNzUNJMJ
         hktZxWHJrZihay/pxGcpNXrOyWWiBkKJQ8rqkQBlSPns44qCCNS1p0e0C+xhy80Lvvmk
         ZJXqwuhLDq2FBi88Euu8SvsCHmjOeHwX+Kv/db/jBffqqZiGXzEjTHK4Sw8yjXF2rC1k
         WBnyOmPRjZytu6f2/HLdT4UyG7F23/VsgwQWkOxWRhN0D3iniwRqowEeR5WYuqRDdg8R
         SekMxxjlYj+RMV9UYw1aBS8RmfCnLawkXpkNJfMfx5WL+/hoD3KtTMLczDSRnxI3nO5M
         SabQ==
X-Gm-Message-State: AG10YOTMUhLby3fYmKA9COhTAHS8fiv4avhNc8K/6axRfyDMwmBjI4zF4K/XXTRR7/uHRA==
X-Received: by 10.182.28.41 with SMTP id y9mr4455179obg.14.1455323294291;
        Fri, 12 Feb 2016 16:28:14 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.64.179 with SMTP id p19ls290297igs.0.gmail; Fri, 12 Feb
 2016 16:28:13 -0800 (PST)
X-Received: by 10.50.61.200 with SMTP id s8mr9552igr.3.1455323293113;
        Fri, 12 Feb 2016 16:28:13 -0800 (PST)
In-Reply-To: <n9l3ns$33l$1@ger.gmane.org>
X-Original-Sender: arthur.j.odwyer@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:24339
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/24339>

------=_Part_1234_442185814.1455323292521
Content-Type: multipart/alternative; 
	boundary="----=_Part_1235_1903403071.1455323292523"

------=_Part_1235_1903403071.1455323292523
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Friday, February 12, 2016 at 9:11:35 AM UTC-8, Matthew Woehlke wrote:
>
> On 2016-02-12 11:30, Oliver Kowalke wrote:=20
> > 2016-02-12 16:06 GMT+01:00 Matthew Woehlke <mwoehlk...@gmail.com=20
> <javascript:>>:=20
> >> I'm not a fan of using magical references to do indirect assignment,=
=20
> >> i.e. any of your proposals, but especially `split`. All of these seem=
=20
> >> backwards, i.e. should be `tpl1 =3D head<3>(tpl);` instead.=20
> >=20
> > I've had std::tie() in mind,=20
> >=20
> > int i...;=20
> > X x...;=20
> > std::tie( i, x) =3D get_tuple();=20
>
> That's also a horribly ugly interface that we shouldn't be perpetuating;=
=20
> http://wg21.link/p0144 solves that exact example ever so much better...=
=20
>

I think maybe Oliver was trying to say that

    tuple<int, string, string, double> tpl { -1, "abc", "xyz", .5 };
    tuple<string, string, double> tpl1;
    tpl1 =3D tail(tpl);    // Python: tpl1 =3D tpl[1:]
    tail(tpl) =3D tpl1;    // Python: tpl[1:] =3D tpl1


should both work, because tail() should return a tuple of references=20
instead of a tuple of values. I definitely support=20
not-making-unnecessary-copies in general, and particularly in this case if=
=20
it lets tail() work like tie(). But it does seem a little bit=20
non-orthogonal.  (Also, I'm assuming that Oliver made some typos in his=20
original post =E2=80=94 notice I've flipped the "tpl" and "tpl1" in the sec=
ond line=20
above.)

Also, of course, head(x) should logically return get<0>(x), not some weird=
=20
synonym for reverse(tail(reverse(x))). But that's just poor naming. The=20
underlying operation here is either "splice" (extract a contiguous range of=
=20
indices from the input tuple, as in the Python above) or "select" (extract=
=20
a noncontiguous set of indices from the input tuple and compress them, as=
=20
in various vector instruction sets).

I agree that

    std::tuple< int, std::string, std::string, double > tpl{ -1, "abc",=20
"xyz", .5 };
    std::tuple< int, std::string, std::string > tpl1;
    std::tuple< std::string, double > tpl2;
    split( tpl1, tpl2) =3D tpl;

is just nonsense, as written.
However, under the "unpacking with postfix tilde" not-a-proposal, a similar=
=20
operation could be written like this:

    tuple<int, string, string, double> tpl { -1, "abc", "xyz", .5 };
    tuple<int, string> tpl1;
    tuple<string, double> tpl2;

    std::tie(tpl1~..., tpl2~...) =3D tpl;

    assert(std::get<0>(tpl1) =3D=3D std::get<0>(tpl));
    assert(std::get<1>(tpl1) =3D=3D std::get<1>(tpl));
    assert(std::get<0>(tpl2) =3D=3D std::get<2>(tpl));
    assert(std::get<1>(tpl2) =3D=3D std::get<3>(tpl));

In general, I think that the C++ standard library is woefully lacking in=20
tuple manipulators... but rather than proposing new tuple manipulators (of=
=20
which there could be a million: zip, fold, map, car, cdr, reverse,...), we=
=20
should be trying to give people the ability to express those manipulators=
=20
natively in the language, via something like Matthew's [:] notation or my=
=20
~... notation.

my $.02,
=E2=80=93Arthur

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-propos=
als/.

------=_Part_1235_1903403071.1455323292523
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, February 12, 2016 at 9:11:35 AM UTC-8, Matthew =
Woehlke wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 2016-02-12 11=
:30, Oliver Kowalke wrote:
<br>&gt; 2016-02-12 16:06 GMT+01:00 Matthew Woehlke &lt;<a href=3D"javascri=
pt:" target=3D"_blank" gdf-obfuscated-mailto=3D"ceVKogYTHwAJ" rel=3D"nofoll=
ow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=
=3D"this.href=3D&#39;javascript:&#39;;return true;">mwoehlk...@gmail.com</a=
>&gt;:
<br>&gt;&gt; I&#39;m not a fan of using magical references to do indirect a=
ssignment,
<br>&gt;&gt; i.e. any of your proposals, but especially `split`. All of the=
se seem
<br>&gt;&gt; backwards, i.e. should be `tpl1 =3D head&lt;3&gt;(tpl);` inste=
ad.
<br>&gt;=20
<br>&gt; I&#39;ve had std::tie() in mind,
<br>&gt;=20
<br>&gt; int i...;
<br>&gt; X x...;
<br>&gt; std::tie( i, x) =3D get_tuple();
<br>
<br>That&#39;s also a horribly ugly interface that we shouldn&#39;t be perp=
etuating;
<br><a href=3D"http://wg21.link/p0144" target=3D"_blank" rel=3D"nofollow" o=
nmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\75http%3A%2F%2Fw=
g21.link%2Fp0144\46sa\75D\46sntz\0751\46usg\75AFQjCNHRLy3vqbt_AWP1QLZDa6ye8=
6dhPQ&#39;;return true;" onclick=3D"this.href=3D&#39;http://www.google.com/=
url?q\75http%3A%2F%2Fwg21.link%2Fp0144\46sa\75D\46sntz\0751\46usg\75AFQjCNH=
RLy3vqbt_AWP1QLZDa6ye86dhPQ&#39;;return true;">http://wg21.link/p0144</a> s=
olves that exact example ever so much better...
<br></blockquote><div><br></div><div>I think maybe Oliver was trying to say=
 that</div><div><br></div><div class=3D"prettyprint" style=3D"background-co=
lor: rgb(250, 250, 250); border: 1px solid rgb(187, 187, 187); word-wrap: b=
reak-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0 =C2=A0 tuple</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">string</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">string</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,</span><span style=3D"color: #000;" 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">&gt;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> tpl </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: #660;" =
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=
"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;a=
bc&quot;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #080;" class=3D"styled-by-prettify">&quot;xyz&quot;</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #06=
6;" class=3D"styled-by-prettify">5</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br>=C2=A0 =C2=A0 tuple</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">string</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: #008;" class=3D"styled-by-prettify">string</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">double</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> tpl1</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 tpl1 </span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> tail</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">tpl</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> =C2=A0 =C2=A0</span><span style=3D"color: #800;" class=3D"styled-by-prett=
ify">// Python: tpl1 =3D tpl[1:]</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 tail</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">tpl</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: #660;" class=3D"styled-by-prettify=
">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> tpl1=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</spa=
n><span style=3D"color: #800;" class=3D"styled-by-prettify">// Python: tpl[=
1:] =3D tpl1</span></div></code></div><div><br></div><div><br></div><div>sh=
ould both work, because tail() should return a tuple of references instead =
of a tuple of values. I definitely support not-making-unnecessary-copies in=
 general, and particularly in this case if it lets tail() work like tie(). =
But it does seem a little bit non-orthogonal. =C2=A0(Also, I&#39;m assuming=
 that Oliver made some typos in his original post =E2=80=94 notice I&#39;ve=
 flipped the &quot;tpl&quot; and &quot;tpl1&quot; in the second line above.=
)</div><div><br></div><div>Also, of course, head(x) should logically return=
 get&lt;0&gt;(x), not some weird synonym for reverse(tail(reverse(x))). But=
 that&#39;s just poor naming. The underlying operation here is either &quot=
;splice&quot; (extract a contiguous range of indices from the input tuple, =
as in the Python above) or &quot;select&quot; (extract a noncontiguous set =
of indices from the input tuple and compress them, as in various vector ins=
truction sets).</div><div><br></div><div>I agree that</div><div><br></div><=
div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); bo=
rder: 1px solid rgb(187, 187, 187); word-wrap: break-word;"><code class=3D"=
prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">=C2=A0 =C2=A0 std</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">tuple</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">int</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">string</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,</span><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: #008;" class=
=3D"styled-by-prettify">string</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: #008;" class=3D"styled-by-prettify=
">double</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> tpl</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: #6=
60;" class=3D"styled-by-prettify">-</span><span style=3D"color: #066;" clas=
s=3D"styled-by-prettify">1</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&q=
uot;abc&quot;</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: #080;" class=3D"styled-by-prettify">&quot;xyz&quot;=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><s=
pan 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=
: #066;" class=3D"styled-by-prettify">5</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: #000;" class=3D"styled-b=
y-prettify"><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">tuple</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">int<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">string</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">string</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> tp=
l1</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=
 std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">tuple</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span st=
yle=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: =
#008;" class=3D"styled-by-prettify">string</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: #008;" class=3D"style=
d-by-prettify">double</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> tpl=
2</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 =
split</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> tpl1</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> tpl2</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> tpl</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;</span></div></code></div><div><br></div><div>is just nonsense,=
 as written.</div><div>However, under the &quot;unpacking with postfix tild=
e&quot; not-a-proposal, a similar operation could be written like this:</di=
v><div><br></div><div class=3D"prettyprint" style=3D"background-color: rgb(=
250, 250, 250); border: 1px solid rgb(187, 187, 187); word-wrap: break-word=
;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D=
"color: #000;" class=3D"styled-by-prettify">=C2=A0 =C2=A0 tuple</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">string</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: #008;" class=3D"styled-by-prettify=
">string</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">double</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> tpl </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">-</span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">1</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #080;" class=3D"styled-by-prettify">&quot;abc&qu=
ot;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #080;" class=3D"styled-by-prettify">&quot;xyz&quot;</span><sp=
an 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=
: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #066;" =
class=3D"styled-by-prettify">5</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: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 tuple</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&lt;</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: #008;" class=3D"styled-by-prettify">string</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> tpl1</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 tuple</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">string</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: #008;" clas=
s=3D"styled-by-prettify">double</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> tpl2</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br><br>=C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">tie</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">tpl1</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">~...,</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> tpl2</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">~...)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> tpl</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">assert</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
get</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">tpl1</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D=3D</span><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: #008;" class=3D"styled-by-pret=
tify">get</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&=
lt;</span><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">tpl</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">));</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">assert</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">std</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">::</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">get</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">&lt;</span><span style=3D"color: #066;" class=3D"styled-by-pre=
ttify">1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&g=
t;(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">tpl1</s=
pan><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: #660;" class=3D"styled-by-prettify">=3D=3D</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">get</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&lt;</span><span style=3D"color: #066;" class=3D"styled-=
by-prettify">1</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">&gt;(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">t=
pl</span><span style=3D"color: #660;" class=3D"styled-by-prettify">));</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">assert=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">get</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #066;" c=
lass=3D"styled-by-prettify">0</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&gt;(</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify">tpl2</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=3D</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">get</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #0=
66;" class=3D"styled-by-prettify">2</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&gt;(</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">tpl</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">));</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">assert</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">get</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span styl=
e=3D"color: #066;" class=3D"styled-by-prettify">1</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&gt;(</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">tpl2</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">=3D=3D</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #008;" class=3D"styled-by-prettify">get</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><spa=
n style=3D"color: #066;" class=3D"styled-by-prettify">3</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">tpl</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">));</span></div></code></div><div><div><=
br></div></div><div>In general, I think that the C++ standard library is wo=
efully lacking in tuple manipulators... but rather than proposing new tuple=
 manipulators (of which there could be a million: zip, fold, map, car, cdr,=
 reverse,...), we should be trying to give people the ability to express th=
ose manipulators natively in the language, via something like Matthew&#39;s=
 [:] notation or my ~... notation.</div><div><br></div><div>my $.02,</div><=
div>=E2=80=93Arthur</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&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 />
Visit this group at <a href=3D"https://groups.google.com/a/isocpp.org/group=
/std-proposals/">https://groups.google.com/a/isocpp.org/group/std-proposals=
/</a>.<br />

------=_Part_1235_1903403071.1455323292523--
------=_Part_1234_442185814.1455323292521--

.
