220 29603 <e3a2acfe-dbb6-4f8f-84da-8debda38a4fc@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Add a "tuple_slice" function in <tuple>
Date: Wed, 30 Nov 2016 16:23:11 -0800 (PST)
Lines: 193
Approved: news@gmane.org
Message-ID: <e3a2acfe-dbb6-4f8f-84da-8debda38a4fc@isocpp.org>
References: <490cad18-4302-4350-976f-2bc394a1a350@isocpp.org>
 <583F4A4F.7020708@gmail.com>
 <945de37f-352d-008f-a29b-d354999c6c4c@wanadoo.fr>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_83_1438348746.1480551791493"
X-Trace: blaine.gmane.org 1480551796 20317 195.159.176.226 (1 Dec 2016 00:23:16 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 1 Dec 2016 00:23:16 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBB4G27XAQKGQEPFLWE3I@isocpp.org Thu Dec 01 01:23:10 2016
Return-path: <std-proposals+bncBCEKFTV6ZUMBB4G27XAQKGQEPFLWE3I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f199.google.com ([209.85.223.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBB4G27XAQKGQEPFLWE3I@isocpp.org>)
	id 1cCF9Z-0004OS-Ec
	for gclcip-std-proposals@m.gmane.org; Thu, 01 Dec 2016 01:23:09 +0100
Original-Received: by mail-io0-f199.google.com with SMTP id g8sf45837749ioi.0
        for <gclcip-std-proposals@m.gmane.org>; Wed, 30 Nov 2016 16:23:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :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=stdt4nmuUJjAJ9+M5E/20GdKCuIKwUw5CpVMt6xTgKg=;
        b=Rri/NodyCk+LrTu9aYQG6Wf6/aLy+rRL8LW5UC+kKAChGZXpzJYDKsPGYq2lCNG5pQ
         vuCS6th1ko0WZ7Pw7OQ1NXgRE2gFQXclvGb4yaSWOxUON6DCLnJGHn+1qZHM1JDnfteW
         M7nsnErkO+2fw6hnPPN5hkB/E4/Q4MYVLgztK8S6gxG7bJfR2JCRMJeGxSeWu/ANRu5Z
         NhUrmj4II0G9Ztce/N4Tm3nRnFvRtRl66QhGNwYZkAFrRax4qs1Ex0S5D5jfMyrSuhtj
         ABiByzkZ1dTIQrq8YMUkayB+4bqP83B1WQhvnLGfBOLxmZch0VlcJAs/rLNjt1n0ITVX
         k1CQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :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=stdt4nmuUJjAJ9+M5E/20GdKCuIKwUw5CpVMt6xTgKg=;
        b=OGAuYF1brsgD4WQks0mF4NzDaN86bnPQYnRoDjhNQCkYl/j5xeI+yrrZMUZ2ZTHgxZ
         XBrnQckFRlFAvNV966guObI56lE8MfeWXniPZ+LP2BsOIk7a+LOP8rnxU+rKeXCIgFno
         CjYdJXOR2fxtcY1p/FMCpNolqvjQHLmsu/vF0sOmv5aHWipkS8S2c5b5VJcnhTQfg70R
         G2DRGFGycmg0lmNzdYQVVTOBKxnT9axkCGBox+uQPzgXTD9cICfwfjiiysUnc5BhyDTo
         9Hc7OaInaZQnz+P6ECz0k2t0XI96urxlXSky7OKkF8Wng1S5+kdEcHlngRjdxevmhjgL
         BfnQ==
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:message-id:in-reply-to:references
         :subject:mime-version: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=stdt4nmuUJjAJ9+M5E/20GdKCuIKwUw5CpVMt6xTgKg=;
        b=Lm/T9dCagleXdJ8AYnwqCe5BM+hqSlhGrzOzknRctbKwUrhURiUbexgMYJsGKKHAZe
         OIs6+BTJ5vJ6bzguOjcGH7nnYjNhRfqZ+Zdf4hmfwm1K5PLrxTPdgzNNHHMKNLBhxZID
         l9njquO/Bjep/wMaN7/IqOwVrhwOP7iFwbh6rTkBgqps+Hvr7Pmf92wqtUAg23msiC+U
         Qg813QytOdgFztFbB+kLkd1T0moKvqKjno5Xor2EYMfVe+uBwCc/2/Q1KCQUKHylTUH3
         0EqmQXnqHcAEhnC2UJtt/IqcCu+4+eXtCt+ZhKn2p3zNYOB2XnMxBzzYXipgJs2lU9ft
         /pPA==
X-Gm-Message-State: AKaTC00y4bBfWFUX6ZoDAfJhqvAFuz5rNWjnSDAtMWwo8XyRIsbs3RC2NyeotMUYb4AUEg==
X-Received: by 10.107.15.160 with SMTP id 32mr7807732iop.42.1480551792968;
        Wed, 30 Nov 2016 16:23:12 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.23.193 with SMTP id j59ls17596153otj.24.gmail; Wed, 30 Nov
 2016 16:23:12 -0800 (PST)
X-Received: by 10.157.8.134 with SMTP id 6mr2236310otf.17.1480551792132;
        Wed, 30 Nov 2016 16:23:12 -0800 (PST)
In-Reply-To: <945de37f-352d-008f-a29b-d354999c6c4c@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-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:29603
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29603>

------=_Part_83_1438348746.1480551791493
Content-Type: multipart/alternative; 
	boundary="----=_Part_84_91076247.1480551791494"

------=_Part_84_91076247.1480551791494
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



On Wednesday, November 30, 2016 at 5:41:18 PM UTC-5, Vicente J. Botet=20
Escriba wrote:
>
> Le 30/11/2016 =C3=A0 22:53, Matthew Woehlke a =C3=A9crit :=20
> > On 2016-11-30 16:04, =CE=9D=CE=B9=CE=BA=CF=8C=CE=BB=CE=B1=CE=BF=CF=82 =
=CE=91=CE=B8=CE=B1=CE=BD=CE=B1=CF=83=CE=AF=CE=BF=CF=85 wrote:=20
> >> Just floating the idea before composing the complete text. I recently=
=20
> *blogged=20
> >> <https://ngathanasiou.wordpress.com/2016/11/28/want-a-std-slice/>*abou=
t=20
> a=20
> >> hypothetical tuple slice functionality (and related design=20
> considerations)=20
> >> and it seems useful & simple enough (conceptually and implementation=
=20
> wise)=20
> >> to be added in isolation to the Standard library (it may just have bee=
n=20
> >> overlooked in previous versions, I couldn't find related proposals).=
=20
> > If we had generalized slicing, would the proposed library function offe=
r=20
> > anything superior to `std::make_tuple([I1:I2]product_type...)`?=20
> >=20
> > (Generalized slicing would work both on *any* product type, as well as=
=20
> > on parameter packs, so in at least that sense, it is superior to a=20
> > library function that operates only on std::tuple.)=20
> >=20
> I agree that new algorithms should work on ProductTypes [P0327R1]. It is=
=20
> not yet clear  to me how we would have the same syntax for ProductTypes=
=20
> and parameter packs. I'm not saying that I'm against, just that we don't=
=20
> have yet a clear proposal for this common access. While this could be=20
> user friendly, it doesn't compose well in generic code.=20
>
> I believe it is worth defining algorithms that do whatever we want=20
> independently of the precise implementation and the possible language=20
> evolution.=20
>
> I'm considering defining some kind of ProductType views as we could have=
=20
> Range views. product_type::slice<I1,I2>(pt) could return a lazy=20
> product_type::slice_view<I1,I2, PT>. This should be more efficient,=20
> needs to store a reference to the ProductType instead to a reference to=
=20
> each one of the elements of the product type. Sorry, but I don't have=20
> neither a draft paper nor an implementation to show yet.=20
>
> What do you think of this suggested product type views?=20
>
> BTW, would slicing [I1,I2]pt... return a pack or a product type? Or a=20
> view?=20
>

It is none of those:

* `pt` is an expression that results in a "product type".

* `[:]pt` is a product type pack, which is behaviorally identical to a=20
parameter pack, save the fact that it unpacks into a sequence of=20
`get<i>(pt)` calls.

* `[I1:I2]pt` is a product type pack that goes from `get<I1>` to `get<I2>`,=
=20
rather than across the entire range of `pt`.

* `[I1:I2]pt...` unpacks the pack, which works exactly like unpacking a=20
parameter pack.

--=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/e3a2acfe-dbb6-4f8f-84da-8debda38a4fc%40isocpp.or=
g.

------=_Part_84_91076247.1480551791494
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Wednesday, November 30, 2016 at 5:41:18 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;">Le 30/11/2016 =C3=A0 22:53, Matthew Woehlke a =C3=A9crit :
<br>&gt; On 2016-11-30 16:04, =CE=9D=CE=B9=CE=BA=CF=8C=CE=BB=CE=B1=CE=BF=CF=
=82 =CE=91=CE=B8=CE=B1=CE=BD=CE=B1=CF=83=CE=AF=CE=BF=CF=85 wrote:
<br>&gt;&gt; Just floating the idea before composing the complete text. I r=
ecently *blogged
<br>&gt;&gt; &lt;<a href=3D"https://ngathanasiou.wordpress.com/2016/11/28/w=
ant-a-std-slice/" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.hr=
ef=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fngathanasiou.wordpr=
ess.com%2F2016%2F11%2F28%2Fwant-a-std-slice%2F\x26sa\x3dD\x26sntz\x3d1\x26u=
sg\x3dAFQjCNHKdHZP3i-sb9B8mj2zsgcFU8wugA&#39;;return true;" onclick=3D"this=
..href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fngathanasiou.wor=
dpress.com%2F2016%2F11%2F28%2Fwant-a-std-slice%2F\x26sa\x3dD\x26sntz\x3d1\x=
26usg\x3dAFQjCNHKdHZP3i-sb9B8mj2zsgcFU8wugA&#39;;return true;">https://ngat=
hanasiou.<wbr>wordpress.com/2016/11/28/want-<wbr>a-std-slice/</a>&gt;*about=
 a
<br>&gt;&gt; hypothetical tuple slice functionality (and related design con=
siderations)
<br>&gt;&gt; and it seems useful &amp; simple enough (conceptually and impl=
ementation wise)
<br>&gt;&gt; to be added in isolation to the Standard library (it may just =
have been
<br>&gt;&gt; overlooked in previous versions, I couldn&#39;t find related p=
roposals).
<br>&gt; If we had generalized slicing, would the proposed library function=
 offer
<br>&gt; anything superior to `std::make_tuple([I1:I2]<wbr>product_type...)=
`?
<br>&gt;
<br>&gt; (Generalized slicing would work both on *any* product type, as wel=
l as
<br>&gt; on parameter packs, so in at least that sense, it is superior to a
<br>&gt; library function that operates only on std::tuple.)
<br>&gt;
<br>I agree that new algorithms should work on ProductTypes [P0327R1]. It i=
s=20
<br>not yet clear =C2=A0to me how we would have the same syntax for Product=
Types=20
<br>and parameter packs. I&#39;m not saying that I&#39;m against, just that=
 we don&#39;t=20
<br>have yet a clear proposal for this common access. While this could be=
=20
<br>user friendly, it doesn&#39;t compose well in generic code.
<br>
<br>I believe it is worth defining algorithms that do whatever we want=20
<br>independently of the precise implementation and the possible language=
=20
<br>evolution.
<br>
<br>I&#39;m considering defining some kind of ProductType views as we could=
 have=20
<br>Range views. product_type::slice&lt;I1,I2&gt;(pt) could return a lazy=
=20
<br>product_type::slice_view&lt;I1,<wbr>I2, PT&gt;. This should be more eff=
icient,=20
<br>needs to store a reference to the ProductType instead to a reference to=
=20
<br>each one of the elements of the product type. Sorry, but I don&#39;t ha=
ve=20
<br>neither a draft paper nor an implementation to show yet.
<br>
<br>What do you think of this suggested product type views?
<br>
<br>BTW, would slicing [I1,I2]pt... return a pack or a product type? Or a v=
iew?
<br></blockquote><div><br>It is none of those:<br><br>* `pt` is an expressi=
on that results in a &quot;product type&quot;.<br><br>* `[:]pt` is a produc=
t type pack, which is behaviorally identical to a parameter pack, save the =
fact that it unpacks into a sequence of `get&lt;i&gt;(pt)` calls.<br><br>* =
`[I1:I2]pt` is a product type pack that goes from `get&lt;I1&gt;` to `get&l=
t;I2&gt;`, rather than across the entire range of `pt`.<br><br>* `[I1:I2]pt=
....` unpacks the pack, which works exactly like unpacking a parameter pack.=
</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/e3a2acfe-dbb6-4f8f-84da-8debda38a4fc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e3a2acfe-dbb6-4f8f-84da-8debda38a4fc=
%40isocpp.org</a>.<br />

------=_Part_84_91076247.1480551791494--

------=_Part_83_1438348746.1480551791493--

.
