220 32504 <CAGsORuDWRidpKi6nj5Bm8m+hHTy7PVKzzZFq_=vaA7XMdb3odw@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Zhihao Yuan <zy@miator.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Allow Structured Binding Outside of Variable Declaration
Date: Tue, 16 May 2017 17:43:58 -0500
Lines: 98
Approved: news@gmane.org
Message-ID: <CAGsORuDWRidpKi6nj5Bm8m+hHTy7PVKzzZFq_=vaA7XMdb3odw@mail.gmail.com>
References: <e02d79e8-7d80-4614-bd25-e73fb43dad9d@isocpp.org>
 <10b21241-b683-44d5-82ce-90681b2643a4@isocpp.org> <CAFk2RUbf5skMEcsLd_hUiZrib2bGCvyrJbgsx9LV-rXaj=fBZw@mail.gmail.com>
 <CAFk2RUbgg7UMc_mFGKQZF7-PVVbEDsdoZoXL46oyxr+PLRTfvw@mail.gmail.com>
 <08ff73f1-6989-393e-ee4e-8158af2e7bed@honermann.net> <CAFk2RUaBhq7KVukgRMvqBMuBiBwZmCf+xZpD9jRtBberFoU2Rg@mail.gmail.com>
 <c70b0cd6-fa3e-d215-3fef-06eb231ed3cd@honermann.net> <CAFk2RUbiUZ4n_mXdBUTGEZSsh5C=Mf0hKbKu76PKzCCWnZfrgA@mail.gmail.com>
 <d184a83a-4f99-a8d2-6bba-1b8aeedd797c@honermann.net> <20170516164245.GA16348@fukushima.lysator.liu.se>
 <ffcb4ca3-5fb8-41b4-8b38-cfd287148cd5@honermann.net> <CAFk2RUY1AYOen-Rb8n6yzc1jsOiydbUCUDqLdKMPyiyiHnnO4w@mail.gmail.com>
 <c0bf3a06-53e5-3411-0967-b167da5d0dcd@honermann.net> <CAFk2RUYaNuKM=xhLTP_ZE97KvRUAJybUhaoFAmT+V_-7P3t1Mg@mail.gmail.com>
 <CAGsORuBgzhCGGPYAWjSDg40xhGnV_ghcVTAvn3xaBFz52vs7xw@mail.gmail.com> <CAFk2RUahRzietkqHtmPrRNSmEorfKF8TfiHGNAB_JDMhC4PU+g@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="f403045c50565645bc054fabe857"
X-Trace: blaine.gmane.org 1494974642 17171 195.159.176.226 (16 May 2017 22:44:02 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 16 May 2017 22:44:02 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCSKRWMD4EHBBMMB53EAKGQEN566MPQ@isocpp.org Wed May 17 00:43:57 2017
Return-path: <std-proposals+bncBCSKRWMD4EHBBMMB53EAKGQEN566MPQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f72.google.com ([209.85.214.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCSKRWMD4EHBBMMB53EAKGQEN566MPQ@isocpp.org>)
	id 1dAlC9-0004Jj-1H
	for gclcip-std-proposals@m.gmane.org; Wed, 17 May 2017 00:43:57 +0200
Original-Received: by mail-it0-f72.google.com with SMTP id e65sf115366057ita.1
        for <gclcip-std-proposals@m.gmane.org>; Tue, 16 May 2017 15:44:03 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1494974642; cv=pass;
        d=google.com; s=arc-20160816;
        b=KqMi9FLHW2OPqs9pudew2/9SOTgHkZAgY48/tNlWrNCNQYSfJZxqtMlcZQv4csv2WM
         /g5dAUlb4XrTWfaLIt3OqGuhscotJ8VbLLP4S9A9r8Y09TatEc0qdzKyGLPVTC1/4P15
         W4nwZtlYEva48E9lNCCToItrq0wudjpGlSFqDAVqj+u1LJBKKoXGMRq4X+JFACboVYb2
         akYGEeLk18YxC2+yQcTCCILNxTbe2Fd6lkdZz69yTPw23RKjXiNNYSoZhbFfTErZJ/Aj
         ck3Mud+y3ZiHIKtUhTAGpeUPmelAY6gaDUZY4aq/Lvr+1OdTFikb059sFQ9avyiIQDLm
         x5Gg==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:sender
         :arc-authentication-results:arc-message-signature
         :arc-authentication-results;
        bh=vMd8fBx0r3zgYUMAn8nI6ZCFPXppu02JrnsUjlKenlM=;
        b=lQRK6ruslM1Q3gCesPDqNfSfePlcDySn9mSA9tlXMYoyhBYXHs2WAIYiT1nq0g7mA6
         Xqva4uY4nvhBXW4F2uWxWb6TaRoV+Wm9oN7zJwTZS8dyJxycpnKgPobzBKXFcJmXUkLI
         ANEmMjnfiACmVryVP16vGT8PPlDQAiXV4xNFIImV4Tz2tE1LTjDabuyxV3P7FtXqoRmG
         lCU+8g1dJsSUbbS/YUcRp89f9lTVk82OS0JJfDEcZDCCPjFvw1MQic1jU+y0nZeXS/KJ
         MeQGI+H3C65VP45pO4tN828qselk+OYO+xUhq1KnBwMTt6bzxP+tOcuoMI25HLua7oa5
         g27A==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@miator.net;
       spf=pass (google.com: domain of bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates 184.173.153.196 as permitted sender) smtp.mailfrom=bounce+3f9131.69110-std-proposals=isocpp.org@miator.net
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:sender:mime-version:in-reply-to:references:from
         :date:message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=vMd8fBx0r3zgYUMAn8nI6ZCFPXppu02JrnsUjlKenlM=;
        b=YQOJ9IcZ9alXWOUvCZPCdUWiwxKaF23bJYNtLwfVRxxlJcUt7OtdQZ9XWXmRhj8mGi
         vbhSr0mG5XVfETNPjON7VqXCpWykGKWOC2XL9PB+MYfZM/9yt2nPWD8U5UfGRhyq3ltf
         xef3jdV4l+PAHHf5IHEZzgsrcjxk1vhlRj9087dQTocmi6F8FdNJqzqF9zchk7hfSG0I
         YfuzVWkIjdJl7yshHCsIpwdx03oG9hpnnnOVmZBXzL9V11hqiOa72+pHukNDqvP9l8pw
         ei+7fotgZAEiFNhRqfrysl1smov7PKNfxU8+78bWgzB95IlXKphkI/m8LoNdjxjZWOXu
         3y1A==
X-Gm-Message-State: AODbwcB90k47ejU6qsvuP1YPKJ2LhfvIGJGdzCN5tgBFAqXHBB5a8W1z
	abh1lFxesrO8N80w
X-Received: by 10.107.51.12 with SMTP id z12mr150672ioz.57.1494974642449;
        Tue, 16 May 2017 15:44:02 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.6.201 with SMTP id 67ls2464315otx.29.gmail; Tue, 16 May
 2017 15:44:01 -0700 (PDT)
X-Received: by 10.55.69.72 with SMTP id s69mr273315qka.175.1494974641581;
        Tue, 16 May 2017 15:44:01 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1494974641; cv=none;
        d=google.com; s=arc-20160816;
        b=X1rXvcqoaSeriVhjX0m3Fi49LRI9FBC8fEEc/1AQn3+4elv244Vz5Dx80nlqYV/FYK
         4H2W9ZunYApFSIZuUohQgGypoYSH7sKrG48rMpIWpyATvkusO/cimKcHbjQtmWHjlUHB
         1YCwq9umDwrYn2ABmDnS6TXE0NStaCSw+hG+YvmL1ZoXBbqyYiBQN3Po24RbikhKS1wj
         3qdCCc8WgIRKDPaQ/vw2QKpn7FiGTx7Zdusl/KRtU5R3jHLY67EArQPRE+yEu7hC01vq
         ArlFjep69iRwobiSOldhssJ6+mGzmioF6HMOHTwVx/tkQFPpR7pmbKvXaAQqd26U+iX2
         oloQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :sender:domainkey-signature:dkim-signature
         :arc-authentication-results;
        bh=nEQGrgaH0TXEyIFXr4p2KqWpGafCysqjDlq44F98i2Q=;
        b=llKBCBDOxKlhOMHChl0AyS9yt6kXzANAvR1sEPZT1q+4Vd8B1HWFf77ksORcYioPwz
         PA2Y8o+WpCbgbQD6F7WwOLbjNtMyPKkKGUCRQ7jLETv/hYrvYMooMHCPQ2/yO3xVXVDD
         VCe94qMsh7xzFyHH5/WpRZrUa5h09g6W6I+4UYGqLbfCdfYsMve7E89pKGcI99m2labN
         uKvBfkv6WFqoZzjisBIFNxMfIjMTzGGxLs3H7kxjWpNT+gWHUkV1PuFgolHjM/qFE1gz
         eZk9b64TNTuQYtusfdwUWA6xmxNM8dLYAkLQO1g+PkfNey7OT9oNtC77DOjsENPY46n7
         P7vQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@miator.net;
       spf=pass (google.com: domain of bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates 184.173.153.196 as permitted sender) smtp.mailfrom=bounce+3f9131.69110-std-proposals=isocpp.org@miator.net
Original-Received: from mail-s68.mailgun.info (mail-s68.mailgun.info. [184.173.153.196])
        by mx.google.com with UTF8SMTPS id g2si170029qte.191.2017.05.16.15.44.01
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 16 May 2017 15:44:01 -0700 (PDT)
Received-SPF: pass (google.com: domain of bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates 184.173.153.196 as permitted sender) client-ip=184.173.153.196;
Original-Sender: zy@miator.net
X-Mailgun-Sending-Ip: 184.173.153.196
X-Mailgun-Sid: WyI3MTBkYiIsICJzdGQtcHJvcG9zYWxzQGlzb2NwcC5vcmciLCAiNjkxMTAiXQ==
Original-Received: from mail-pg0-f53.google.com (mail-pg0-f53.google.com [74.125.83.53])
 by mxa.mailgun.org with ESMTP id 591b80b0.7fce98184270-smtp-out-n02;
 Tue, 16 May 2017 22:44:00 -0000 (UTC)
Original-Received: by mail-pg0-f53.google.com with SMTP id u28so83045721pgn.1
        for <std-proposals@isocpp.org>; Tue, 16 May 2017 15:44:00 -0700 (PDT)
X-Received: by 10.99.109.130 with SMTP id i124mr337970pgc.117.1494974639520;
 Tue, 16 May 2017 15:43:59 -0700 (PDT)
Original-Received: by 10.100.151.71 with HTTP; Tue, 16 May 2017 15:43:58 -0700 (PDT)
In-Reply-To: <CAFk2RUahRzietkqHtmPrRNSmEorfKF8TfiHGNAB_JDMhC4PU+g@mail.gmail.com>
X-Gmail-Original-Message-ID: <CAGsORuDWRidpKi6nj5Bm8m+hHTy7PVKzzZFq_=vaA7XMdb3odw@mail.gmail.com>
X-Original-Sender: zy@miator.net
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@miator.net;       spf=pass (google.com: domain of
 bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates
 184.173.153.196 as permitted sender) smtp.mailfrom=bounce+3f9131.69110-std-proposals=isocpp.org@miator.net
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <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:32504
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32504>

--f403045c50565645bc054fabe857
Content-Type: text/plain; charset="UTF-8"

On Tue, May 16, 2017 at 5:36 PM, Ville Voutilainen <
ville.voutilainen@gmail.com> wrote:

> > How about this
> >
> >   for (TupleLike<A, B> [x, y] : something) { ... }
> >
> > Where TupleLike is a concept.
>
> How does that help me specify the concrete types of the bindings?


It does type-check, as same as you putting

  static_assert(is_same_v<decltype(x), A>);

in the loop.

But it doesn't change the type object of the
underlying object, or the type of the bindings.

If you want to bind to different types, you can
cast one the right hand side:

  auto [x, y] = rebind<NewA, NewB>(something);

where `rebind` converts a tuple-like to a
std::tuple, or some thin wrappers if you prefer.

-- 
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGsORuDWRidpKi6nj5Bm8m%2BhHTy7PVKzzZFq_%3DvaA7XMdb3odw%40mail.gmail.com.

--f403045c50565645bc054fabe857
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
On Tue, May 16, 2017 at 5:36 PM, Ville Voutilainen <span dir=3D"ltr">&lt;<a=
 href=3D"mailto:ville.voutilainen@gmail.com" target=3D"_blank">ville.voutil=
ainen@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" =
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pa=
dding-left:1ex"><span class=3D"gmail-">&gt; How about this<br>
&gt;<br>
&gt;=C2=A0 =C2=A0for (TupleLike&lt;A, B&gt; [x, y] : something) { ... }<br>
&gt;<br>
&gt; Where TupleLike is a concept.<br>
<br>
</span>How does that help me specify the concrete types of the bindings?</b=
lockquote></div><br></div><div class=3D"gmail_extra">It does type-check, as=
 same as you putting<br><br>=C2=A0 <span class=3D"gmail-im">static_assert(i=
s_same_v&lt;<wbr>decltype(x), A&gt;);<br><br></span></div><div class=3D"gma=
il_extra"><span class=3D"gmail-im">in the loop.<br><br></span></div><div cl=
ass=3D"gmail_extra"><span class=3D"gmail-im">But it doesn&#39;t change the =
type object of the<br></span></div><div class=3D"gmail_extra"><span class=
=3D"gmail-im">underlying object, or the type of the bindings.<br><br></span=
></div><div class=3D"gmail_extra"><span class=3D"gmail-im">If you want to b=
ind to different types, you can<br></span></div><div class=3D"gmail_extra">=
<span class=3D"gmail-im">cast one the right hand side:<br><br></span></div>=
<div class=3D"gmail_extra"><span class=3D"gmail-im">=C2=A0 auto [x, y] =3D =
rebind&lt;NewA, NewB&gt;(something);<br><br></span></div><div class=3D"gmai=
l_extra"><span class=3D"gmail-im">where `rebind` converts a tuple-like to a=
<br>std::tuple, or some thin wrappers if you prefer.<br></span></div><div c=
lass=3D"gmail_extra"><br>-- <br><div class=3D"gmail_signature"><div dir=3D"=
ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div>Zhihao Yuan, ID lichr=
ay<br>The best way to predict the future is to invent it.<br>______________=
_________________________________<br></div></div></div></div></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&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/CAGsORuDWRidpKi6nj5Bm8m%2BhHTy7PVKzzZ=
Fq_%3DvaA7XMdb3odw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGsORuDWRidp=
Ki6nj5Bm8m%2BhHTy7PVKzzZFq_%3DvaA7XMdb3odw%40mail.gmail.com</a>.<br />

--f403045c50565645bc054fabe857--

.
