220 23568 <d29c1908-3f42-4047-8802-6bf2fb4942f0@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: n4428 and Tuple-like access interface reflection
Date: Wed, 6 Jan 2016 21:02:51 -0800 (PST)
Lines: 500
Approved: news@gmane.org
Message-ID: <d29c1908-3f42-4047-8802-6bf2fb4942f0@isocpp.org>
References: <56770133.7070701@wanadoo.fr> <5681D877.3010101@wanadoo.fr>
 <43daa6cd-e152-43c1-ab51-0661779d344b@isocpp.org>
 <n5ug1h$fgg$1@ger.gmane.org>
 <CAB+4KH+bBEwFidv=a5wuOLbyBtSTwy0TKB=r_7Mc_8vx_bRrPA@mail.gmail.com>
 <n60u6u$7ov$1@ger.gmane.org> <568942A9.80700@wanadoo.fr>
 <n6e4n4$q68$1@ger.gmane.org> <568B0DA1.3080704@wanadoo.fr>
 <b98e9903-52b2-41b4-ac89-8c3e8df4d9c1@isocpp.org>
 <n6gnfr$57q$1@ger.gmane.org>
 <7d4bd204-e4c3-4f60-8be5-63d8127daf74@isocpp.org>
 <n6grh7$b8q$1@ger.gmane.org>
 <487ea013-6fcb-4d2e-8bc7-8fe96cdbf0a9@isocpp.org>
 <568C3EC7.8070900@wanadoo.fr>
 <a6ad88f3-2309-499a-aeca-834ecb0dfd0d@isocpp.org>
 <568D5959.9000501@wanadoo.fr>
 <c087a17d-6ab0-40d3-acd7-e7c364edd388@isocpp.org>
 <568D8DD7.30303@wanadoo.fr>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1145_483468076.1452142972091"
X-Trace: ger.gmane.org 1452142978 7004 80.91.229.3 (7 Jan 2016 05:02:58 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 7 Jan 2016 05:02:58 +0000 (UTC)
Cc: mwoehlke.floss@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBB7PCW62AKGQEMRE3YEQ@isocpp.org Thu Jan 07 06:02:57 2016
Return-path: <std-proposals+bncBCEKFTV6ZUMBB7PCW62AKGQEMRE3YEQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f72.google.com ([209.85.213.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBB7PCW62AKGQEMRE3YEQ@isocpp.org>)
	id 1aH2it-0007dZ-KR
	for gclcip-std-proposals@m.gmane.org; Thu, 07 Jan 2016 06:02:55 +0100
Original-Received: by mail-vk0-f72.google.com with SMTP id i129sf67297731vkb.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 06 Jan 2016 21:02:55 -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=I8DNVLJ4pOYAGKNbYmNo79Kuttu/Yun9hKf3sUNPnAc=;
        b=Lcpwi7Trw/7BJUfSHv0a2j2dL86osE6oeLLXNfg8+SgbP8PaMBl/hJ7LRSgSmHTkLW
         OV+2ArEIe6fOMQn7r8ADpoKE+ieExqWlCQyTa+H1Oxu6ivU1GvTrbF8zrG6U7otEtnkH
         HjuQdeztMFfAEElkPsC9TTNrNVTfKDf0i+ZYQETfQ5KiHqjZ3umZTTzXilw+D7yI+7cI
         wtDAmSYimtB+G6w/1k3mdDWMfDDBda0joNAh0KMI80+EpZYc6uBphFuF6cfZatL5ZgfK
         CQBpsqufSBxHoVwQbNI6NHyOuVeudtpj4WlnFDoxqx+qhY9eNP08ZjnqT72e3xjzESwQ
         JPlA==
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=I8DNVLJ4pOYAGKNbYmNo79Kuttu/Yun9hKf3sUNPnAc=;
        b=rX2wAXccaG4DPyDlhTH6dge/4dlA9oysnXjFw1tUY2z2MwQSO85lEdysydc3ftzOME
         cnCP4sxUylr9odM4V9q2J7ejbmqPhDwsOJEhKAFlJV49B8582f1x8BrOnfHTZwRnv/QJ
         rJOANwvJtdJL3z9Oj3aDs9wrlvyQE/fe7nEOlg9DW6Xut6/s35NqgEbJcKNCI+x99xVW
         nPXerC7utQkZ7vebB8tiSrbx/HZuHILYSnsl0u2eaRKzuYkehmrZasKIS/KyzMEEI3Gv
         2UQ28GeY8OuFAguYisn5FKDIJNqIgm9cPa0qchXWiKC8BLOcBLeUWdYhyI1FsI5a93I4
         nyWQ==
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=I8DNVLJ4pOYAGKNbYmNo79Kuttu/Yun9hKf3sUNPnAc=;
        b=X8mhw/Udu//NjWdPPI2b+O8mTIBxv0eOEtWtAYjdFBtNZbnDLrn4f/+SYEP9qeBXVX
         punq5mSvyyM68CfVDUHIAXWMsmxVrAU4LfvpJsk+wjS6O4rFc3h0LRCbjmEKQ0OrA8Aa
         VYYgcE3DhLMyycgUJyWue1/Z0pnYYwFxXGqwCSyEVfjAhvhslUW6QI6z9q2bcMMR1aYg
         8OTFe0uNs9Fir4huhBnXQKMOvQMUPVtsNu9XOreBzNgYBgJBILIiF7jQWwEoJO3/4Ni7
         JHCBVrySeUBo8rw42tjw9NDKA6dLuwsandns0k66jWNQM8PZYPtg5hzqqtizvCbmKiL/
         W5Vg==
X-Gm-Message-State: ALoCoQlU7pOSGsBi0wRMYKDvVwqeHAC1STceI6Ibb5v8P4iAymRd/tVGGzQIZNTlJ+D8CaPGiFth4BAI+QgtY/EyCMg+ef9x2g==
X-Received: by 10.31.47.202 with SMTP id v193mr91078382vkv.6.1452142974623;
        Wed, 06 Jan 2016 21:02:54 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.50.139 with SMTP id c11ls761357igo.38.canary; Wed, 06 Jan
 2016 21:02:53 -0800 (PST)
X-Received: by 10.50.118.7 with SMTP id ki7mr428638igb.7.1452142973266;
        Wed, 06 Jan 2016 21:02:53 -0800 (PST)
In-Reply-To: <568D8DD7.30303@wanadoo.fr>
X-Original-Sender: jmckesson@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:23568
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/23568>

------=_Part_1145_483468076.1452142972091
Content-Type: multipart/alternative; 
	boundary="----=_Part_1146_1561077075.1452142972092"

------=_Part_1146_1561077075.1452142972092
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wednesday, January 6, 2016 at 4:57:47 PM UTC-5, Vicente J. Botet Escriba=
=20
wrote:
>
> Le 06/01/2016 19:40, Nicol Bolas a =C3=A9crit :
>
> On Wednesday, January 6, 2016 at 1:13:48 PM UTC-5, Vicente J. Botet=20
> Escriba wrote:=20
>>
>> Le 06/01/2016 18:49, Nicol Bolas a =C3=A9crit :
>>
>> On Tuesday, January 5, 2016 at 5:08:09 PM UTC-5, Vicente J. Botet Escrib=
a=20
>> wrote:=20
>>>
>>> Le 05/01/2016 19:20, Nicol Bolas a =C3=A9crit :
>>>
>>> On Tuesday, January 5, 2016 at 11:38:11 AM UTC-5, Matthew Woehlke wrote=
:=20
>>>>
>>>> On 2016-01-05 11:00, Nicol Bolas wrote:=20
>>>> > On 2016-01-04 22:08, Ville Voutilainen wrote:=20
>>>> >>> The question is why would you check for an aggregate?=20
>>>> >>=20
>>>> >> The goal is that get<N> would be implicitly defined for any=20
>>>> "aggregate".=20
>>>> >> It should *not* be defined however for types that have non-public=
=20
>>>> >> NSDM's. The question is how to achieve this.=20
>>>> >>=20
>>>> >> I should note that one answer is "compiler magic". If a standard=20
>>>> trait=20
>>>> >> is going to be a problem, that may be a strong argument to use=20
>>>> compiler=20
>>>> >> magic rather than a portable library solution.=20
>>>> >=20
>>>> > Well, reflection of any kind, which this whole idea relies on, is=20
>>>> going to=20
>>>> > require compiler magic.=20
>>>>
>>>> True. The question could be better expressed as whether the compiler=
=20
>>>> magic provides get<N> *directly* (as in, there may be no visible=20
>>>> declaration of the generic form of such), or whether get<N> is=20
>>>> (visibly,=20
>>>> in the standard library) implemented with the help of traits (which=20
>>>> themselves are compiler magic, but have broader applicability).=20
>>>>
>>>
>>> I say let the whole thing be compiler magic. It'd probably be faster to=
=20
>>> compile that way if the compiler can just use intrinsics or whatever to=
=20
>>> enumerate the members of the struct.
>>>
>>> Thanks to all for your help. Could we conclude then that the generation=
=20
>>> should be done when
>>>
>>>    - (1) no private or protected non-static data members and
>>>    - (2) no base classes=20
>>> ?
>>>
>>> Do you see a better characterization?
>>>
>>> We can let the answer to whether it is the compiler that generates them=
 or if they are generated using some missing type trait or reflection trait=
s as an open question. =20
>>>
>>>
>>>
>>> I realized while reading your post that the structured bindings proposa=
l=20
>> also keys off of being an aggregate when it is not, strictly speaking,=
=20
>> necessary.
>>
>> That's when I started to think about what these limitations exist.
>>
>> Aggregate initialization is all about the compiler generating=20
>> construction code on the fly. Looked at from that perspective, the=20
>> reasoning for the exclusions can be understood as follows:
>>
>> 1) *Types with constructors*: You're not supposed to be able to=20
>> initialize a type that has a user-provided constructor with anything=20
>> *except* a call to one of those constructors. That's how they maintain=
=20
>> invariants.
>> 2) *Public-only members*: Access classes exist so that only designated=
=20
>> code can access that value. So you can't initialize such values directly=
;=20
>> only designated code (ie: user-provided constructors) may do so.
>> 3) *Virtual types*: Generating the construction code would require=20
>> dealing with filling in virtual stuff. That's more complex code which wo=
uld=20
>> best be expressed with a constructor. Also, virtual stuff alters the lay=
out=20
>> of the type.
>> 4) *Types with base classes*: The layout of base classes is not=20
>> well-defined, which makes the initialization code more complex.
>>
>> Notice that C++17 will dispense with #4, presumably because, well, what=
=20
>> does it matter? Yes, the layout is not defined by the standard, but ever=
y=20
>> class *has* a layout. The compiler knows what that layout is, so the=20
>> compiler can figure out how to put each item in the aggregate list in th=
e=20
>> right place.
>>
>> When initializing a type, restriction #3 matters, since you have to fill=
=20
>> out the appropriate information. But that information is irrelevant when=
=20
>> *accessing* NSDMs, either for these auto-tuplizing functions or for=20
>> structured binding.
>>
>> (note: as I think more on this, it may be problematic with virtual=20
>> *inheritance*. But virtual functions themselves ought to be fine,=20
>> implementation-wise.)
>>
>> So when doing structured binding or tuplized access, we should only=20
>> require restrictions #1 and #2 (and possibly no virtual inheritance).
>>
>> I missed why you want to maintain #1. This will eliminate std::tuple and=
=20
>> std::pair :(
>>
>
> They already have tuple-like interfaces. And structured binding will=20
> already need an extensibility mechanism for types that don't fit this=20
> criteria.
>
> So just apply those to `tuple` and `pair`.
>
> Maybe, but why do you want to preserve #1?
>

First, `tuple` doesn't count, as its members are not required to be public,=
=20
nor are they required to be in the appropriate order. So they're going to=
=20
have to use its specialized getters no matter what.

As for the more general question... I suppose it is not *strictly*=20
necessary either. So long as *all* of the NSDMs are publicly accessible=20
(and no virtual inheritance), it could still work.

> =20
>
>> I wonder about multiple inheritance. if=20
>>
>>     struct A: A1, A2 {...};
>>
>> Is everyone comfortable with=20
>>
>>     get<0>(a) !=3D get<0>(static_cast<A2&>(a)
>>
>
> Yes. It matches with aggregate initialization in C++17.
> =20
>
>> BTW, what would get<0>(a) be? static_cast<A1&>(a) or=20
>> get<0>(static_cast<A1&>(a))?
>>
>
> The same thing it is in aggregate initialization in C++17.
>
> You didn't replayed to my questions?
>

I didn't? How not? I replied by saying "look at how aggregate=20
initialization in C++17 works. Make it work like that." That's the answer=
=20
I'm comfortable with.

Or let me put it another way. Given this:

SomeType aggregate =3D {val1, val2, val3, val4};

this ought to be true (reference types, movement, etc aside):

get<0>(aggregate) =3D=3D val1;
get<1>(aggregate) =3D=3D val2;
get<2>(aggregate) =3D=3D val3;
get<3>(aggregate) =3D=3D val4;

The index aggregate initialization would have used to set the value (even=
=20
if it's not, strictly speaking, an aggregate) is exactly the index that=20
tuple-based fetching should retrieve the value. And the same should go for=
=20
structured binding.

--=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_1146_1561077075.1452142972092
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wednesday, January 6, 2016 at 4:57:47 PM UTC-5, Vicente J. Botet Escriba=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.=
8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
 =20
   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div>Le 06/01/2016 19:40, Nicol Bolas a
      =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote type=3D"cite">On Wednesday, January 6, 2016 at 1:13:48 PM U=
TC-5,
      Vicente J. Botet Escriba wrote:
      <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex=
;border-left:1px #ccc solid;padding-left:1ex">
        <div bgcolor=3D"#FFFFFF" text=3D"#000000">
          <div>Le 06/01/2016 18:49, Nicol Bolas a =C3=A9crit=C2=A0:<br>
          </div>
          <blockquote type=3D"cite">On Tuesday, January 5, 2016 at 5:08:09
            PM UTC-5, Vicente J. Botet Escriba wrote:
            <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left=
:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor=3D"#FFFFFF" text=3D"#000000">
                <div>Le 05/01/2016 19:20, Nicol Bolas a =C3=A9crit=C2=A0:<b=
r>
                </div>
                <blockquote type=3D"cite">On Tuesday, January 5, 2016 at
                  11:38:11 AM UTC-5, Matthew Woehlke wrote:
                  <blockquote class=3D"gmail_quote" style=3D"margin:0;margi=
n-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">On 2016-01-05 11:=
00,
                    Nicol Bolas wrote: <br>
                    &gt; On 2016-01-04 22:08, Ville Voutilainen wrote: <br>
                    &gt;&gt;&gt; The question is why would you check for
                    an aggregate? <br>
                    &gt;&gt; <br>
                    &gt;&gt; The goal is that get&lt;N&gt; would be
                    implicitly defined for any &quot;aggregate&quot;. <br>
                    &gt;&gt; It should *not* be defined however for
                    types that have non-public <br>
                    &gt;&gt; NSDM&#39;s. The question is how to achieve
                    this. <br>
                    &gt;&gt; <br>
                    &gt;&gt; I should note that one answer is &quot;compile=
r
                    magic&quot;. If a standard trait <br>
                    &gt;&gt; is going to be a problem, that may be a
                    strong argument to use compiler <br>
                    &gt;&gt; magic rather than a portable library
                    solution. <br>
                    &gt; <br>
                    &gt; Well, reflection of any kind, which this whole
                    idea relies on, is going to <br>
                    &gt; require compiler magic. <br>
                    <br>
                    True. The question could be better expressed as
                    whether the compiler <br>
                    magic provides get&lt;N&gt; *directly* (as in, there
                    may be no visible <br>
                    declaration of the generic form of such), or whether
                    get&lt;N&gt; is (visibly, <br>
                    in the standard library) implemented with the help
                    of traits (which <br>
                    themselves are compiler magic, but have broader
                    applicability). <br>
                  </blockquote>
                  <div><br>
                    I say let the whole thing be compiler magic. It&#39;d
                    probably be faster to compile that way if the
                    compiler can just use intrinsics or whatever to
                    enumerate the members of the struct.<br>
                  </div>
                  <br>
                </blockquote>
                Thanks to all for your help. Could we conclude then that
                the generation should be done when<br>
                <pre>   - (1) no private or protected non-static data membe=
rs and
   - (2) no base classes=20
?

Do you see a better characterization?

We can let the answer to whether it is the compiler that generates them or =
if they are generated using some missing type trait or reflection traits as=
 an open question. =20


</pre>
              </div>
            </blockquote>
            <div>I realized while reading your post that the structured
              bindings proposal also keys off of being an aggregate when
              it is not, strictly speaking, necessary.<br>
              <br>
              That&#39;s when I started to think about what these
              limitations exist.<br>
              <br>
              Aggregate initialization is all about the compiler
              generating construction code on the fly. Looked at from
              that perspective, the reasoning for the exclusions can be
              understood as follows:<br>
              <br>
              1) <b>Types with constructors</b>: You&#39;re not supposed to
              be able to initialize a type that has a user-provided
              constructor with anything <i>except</i> a call to one of
              those constructors. That&#39;s how they maintain invariants.<=
br>
              2) <b>Public-only members</b>: Access classes exist so
              that only designated code can access that value. So you
              can&#39;t initialize such values directly; only designated
              code (ie: user-provided constructors) may do so.<br>
              3) <b>Virtual types</b>: Generating the construction code
              would require dealing with filling in virtual stuff.
              That&#39;s more complex code which would best be expressed
              with a constructor. Also, virtual stuff alters the layout
              of the type.<br>
              4) <b>Types with base classes</b>: The layout of base
              classes is not well-defined, which makes the
              initialization code more complex.<br>
              <br>
              Notice that C++17 will dispense with #4, presumably
              because, well, what does it matter? Yes, the layout is not
              defined by the standard, but every class <i>has</i> a
              layout. The compiler knows what that layout is, so the
              compiler can figure out how to put each item in the
              aggregate list in the right place.<br>
              <br>
              When initializing a type, restriction #3 matters, since
              you have to fill out the appropriate information. But that
              information is irrelevant when <i>accessing</i> NSDMs,
              either for these auto-tuplizing functions or for
              structured binding.<br>
              <br>
              (note: as I think more on this, it may be problematic with
              virtual <i>inheritance</i>. But virtual functions
              themselves ought to be fine, implementation-wise.)<br>
              <br>
              So when doing structured binding or tuplized access, we
              should only require restrictions #1 and #2 (and possibly
              no virtual inheritance).<br>
            </div>
          </blockquote>
          I missed why you want to maintain #1. This will eliminate
          std::tuple and std::pair :(<br>
        </div>
      </blockquote>
      <div><br>
        They already have tuple-like interfaces. And structured binding
        will already need an extensibility mechanism for types that
        don&#39;t fit this criteria.<br>
        <br>
        So just apply those to `tuple` and `pair`.<br>
      </div>
    </blockquote>
    Maybe, but why do you want to preserve #1?<br></div></blockquote><div><=
br>First, `tuple` doesn&#39;t count, as its members are not required to be =
public, nor are they required to be in the appropriate order. So they&#39;r=
e going to have to use its specialized getters no matter what.<br><br>As fo=
r the more general question... I suppose it is not <i>strictly</i> necessar=
y either. So long as <i>all</i> of the NSDMs are publicly accessible (and n=
o virtual inheritance), it could still work.<br></div><blockquote class=3D"=
gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc so=
lid;padding-left: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <blockquote type=3D"cite">
      <div>=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 bgcolor=3D"#FFFFFF" text=3D"#000000"> I wonder about multiple
          inheritance. if <br>
          <br>
          =C2=A0=C2=A0=C2=A0 struct A: A1, A2 {...};<br>
          <br>
          Is everyone comfortable with <br>
          <br>
          =C2=A0=C2=A0=C2=A0 get&lt;0&gt;(a) !=3D
          get&lt;0&gt;(static_cast&lt;A2&amp;&gt;(a)<br>
        </div>
      </blockquote>
      <div><br>
        Yes. It matches with aggregate initialization in C++17.<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 bgcolor=3D"#FFFFFF" text=3D"#000000"> BTW, what would
          get&lt;0&gt;(a) be? static_cast&lt;A1&amp;&gt;(a) or
          get&lt;0&gt;(static_cast&lt;A1&amp;&gt;(a))?<br>
        </div>
      </blockquote>
      <div><br>
        The same thing it is in aggregate initialization in C++17.<br>
      </div>
      <br>
    </blockquote>
    You didn&#39;t replayed to my questions?<br></div></blockquote><div><br=
>I didn&#39;t? How not? I replied by saying &quot;look at how aggregate ini=
tialization in C++17 works. Make it work like that.&quot; That&#39;s the an=
swer I&#39;m comfortable with.<br><br>Or let me put it another way. Given t=
his:<br><br><div class=3D"prettyprint" style=3D"background-color: rgb(250, =
250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-wi=
dth: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D=
"subprettyprint"><span style=3D"color: #606;" class=3D"styled-by-prettify">=
SomeType</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a=
ggregate </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 style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">val1</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> val2</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> val3</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> val4</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span></div></code></div><br>this ought to be true (reference types, movemen=
t, etc aside):<br><br><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"><di=
v class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-=
prettify">get</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&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>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">aggregate</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">=3D=3D</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> val1</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"style=
d-by-prettify">get</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&lt;</span><span style=3D"color: #066;" class=3D"styled-by-prettify=
">1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">aggregate</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"> val2</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></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">2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&g=
t;(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">aggrega=
te</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">=3D=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> val3</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" cl=
ass=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-prettify">3</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&gt;(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
aggregate</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">=3D=3D</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> val4</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span></div></code></div><=
br>The index aggregate initialization would have used to set the value (eve=
n if it&#39;s not, strictly speaking, an aggregate) is exactly the index th=
at tuple-based fetching should retrieve the value. And the same should go f=
or structured binding.<br></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_1146_1561077075.1452142972092--
------=_Part_1145_483468076.1452142972091--

.
