220 24391 <n9sqd6$j8i$1@ger.gmane.org> article
Path: news.gmane.org!not-for-mail
From: Matthew Woehlke <mwoehlke.floss@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: [tuple] extracting tuples out of a tuple
Date: Mon, 15 Feb 2016 10:21:10 -0500
Lines: 54
Approved: news@gmane.org
Message-ID: <n9sqd6$j8i$1@ger.gmane.org>
References: <CA+wfc1-FFqOJ9OSme_SpJAmGz+cshbMDVi_dLrF1ztbzkTN-WQ@mail.gmail.com> <n9ksdc$4so$1@ger.gmane.org> <CA+wfc18LVMDXhRYhkw0PxeOmPiOoqVteF7V+40EdOOYb2K1snA@mail.gmail.com> <1604CAB7-DF4D-45B4-A5F8-E21F70491CB7@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1455549710 22730 80.91.229.3 (15 Feb 2016 15:21:50 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 15 Feb 2016 15:21:50 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC37LBFWUIFBB6GZQ63AKGQE5NZ27DI@isocpp.org Mon Feb 15 16:21:42 2016
Return-path: <std-proposals+bncBC37LBFWUIFBB6GZQ63AKGQE5NZ27DI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f69.google.com ([209.85.215.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC37LBFWUIFBB6GZQ63AKGQE5NZ27DI@isocpp.org>)
	id 1aVKxu-0008Pg-7J
	for gclcip-std-proposals@m.gmane.org; Mon, 15 Feb 2016 16:21:30 +0100
Original-Received: by mail-lf0-f69.google.com with SMTP id 78sf50137253lfy.2
        for <gclcip-std-proposals@m.gmane.org>; Mon, 15 Feb 2016 07:21:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=to:from:subject:date:lines:message-id:references:mime-version
         :content-type:content-transfer-encoding:user-agent:in-reply-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=leJ8UtVLpkORFgdV0NA5iumP9yeVuNWRyrQso2oS1Mk=;
        b=0tfqc6XZQJ8faiyjvvONTAi4O2rxS3aQAa0s0AdKUO52MR8rc2+VJDrlCeSS0ubmI9
         IARYi1zlEXNVEahWaapDG+hi8wVzsFKTFPjw12Ts9JycXWzQIUw3NpjNMSfEgw4cyUnh
         p4vD7T3ALM1TgyhqBZt/+0/07c64m1/r8/I0d5AjRqL9UIBvpIh8Xj9AoymsHpmxb++l
         nUXscpOjHrXweo8qy4JYHpjCBQ5Dk5XaJ/v8eVIcR8LF6PND2jZuypQ5Ih7NcKEOg3dF
         yhJtaHaKxVEFMCentgVXXojdqHvP3dvpK7muFhvJ0qQTuSzEvRNFXHQ 
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:content-type:content-transfer-encoding:user-agent
         :in-reply-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=leJ8UtVLpkORFgdV0NA5iumP9yeVuNWRyrQso2oS1Mk=;
        b=NbTPO5Cx1/BStyqS2EDqru5JOgOrwwey6KL9fgKGihh1pGjPm7EXCMSMMT5FHWIizA
         +Aqj2lK3DfnzGMynIrM0Zw0RqJ6YRZe1L6DeHlHH6tTFfaiz4t/BZ/PpT5AkPGYCqRUf
         Yctee+gpjwVc/wyB0bx7hpprtq5wWbWigHp7hFynVuZwxDavALEhP7YhliCgDkJJ7RT9
         slS6ZHqDFvWCRxmNKs1p/Nk8LY7ly4dx5XOl8ZWhjtUrFLmDvVIOvd5PHqJf7X93Wxbp
         +Hs8k3qZG1Q49XxPPKT2m7GW8kaUI1rt7Yhj1XsVh2p3NWTw7pV 
X-Gm-Message-State: AG10YOTZfCwpVtHQoU5+TsLyXqtZn8kqXpuONqHr2E5PnvfRHyTG+gZbtXmwaUyOvFKX4Q==
X-Received: by 10.194.172.40 with SMTP id az8mr1948500wjc.3.1455549689678;
        Mon, 15 Feb 2016 07:21:29 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.25.17.69 with SMTP id g66ls542727lfi.47.gmail; Mon, 15 Feb
 2016 07:21:28 -0800 (PST)
X-Received: by 10.25.23.220 with SMTP id 89mr7231037lfx.49.1455549688043;
        Mon, 15 Feb 2016 07:21:28 -0800 (PST)
Original-Received: from plane.gmane.org (plane.gmane.org. [80.91.229.3])
        by mx.google.com with ESMTPS id gj6si15252156lbc.110.2016.02.15.07.21.27
        for <std-proposals@isocpp.org>
        (version=TLS1 cipher=AES128-SHA bits=128/128);
        Mon, 15 Feb 2016 07:21:28 -0800 (PST)
Received-SPF: pass (google.com: domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as permitted sender) client-ip=80.91.229.3;
Original-Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1aVKxm-0008JG-RS
	for std-proposals@isocpp.org; Mon, 15 Feb 2016 16:21:23 +0100
Original-Received: from tripoint.kitware.com ([66.194.253.20])
        by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Mon, 15 Feb 2016 16:21:22 +0100
Original-Received: from mwoehlke.floss by tripoint.kitware.com with local (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Mon, 15 Feb 2016 16:21:22 +0100
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 42
Original-X-Complaints-To: usenet@ger.gmane.org
X-Gmane-NNTP-Posting-Host: tripoint.kitware.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To: <1604CAB7-DF4D-45B4-A5F8-E21F70491CB7@gmail.com>
X-Original-Sender: mwoehlke.floss@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as
 permitted sender) smtp.mailfrom=gclcip-std-proposals@m.gmane.org;
       dmarc=fail (p=NONE dis=NONE) header.from=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:24391
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/24391>

On 2016-02-13 05:03, David Krauss wrote:
>> On 2016=E2=80=9302=E2=80=9313, at 12:30 AM, Oliver Kowalke wrote:
>>
>> I've had std::tie() in mind,
>=20
> How about a function to get a pack of references from a tuple,

Please, no; we already *have* std::tie, we don't need others (including
split/splice):

  // David's tuple_ref
  std::tie([:]t...);

  // same as proposed std::split
  std::tie([:]tpl1..., [:]tpl2...) =3D std::make_tuple([:]tpl...);

The RHS (second example) can of course be replaced with just `tpl` if
`tpl` is already a std::tuple. Otherwise, this works for any
*tuple-likes*, not just actual std::tuple's, provided that the LHS
get<N>(T&) returns a reference (as it does for e.g. std::tuple, and
presumably would for aggregates when using the implicitly generated
version a la P0197).

> and a generic slice function,
> [snip declaration]
>=20
> tpl1 =3D tuple_slice< 0, 3 >( tpl );
> tpl2 =3D tuple_slice< 2, 2 >( tpl );
> std::tuple_cat( tuple_ref( tpl1 ), tuple_ref( tpl2 ) ) =3D tpl;

I like that you're thinking along the lines of not creating a magical
assignment operator (which is what the proposed head/tail would be; they
necessarily would create a "magical" helper class with a templated
assignment operator which consumes an *arbitrary* tuple of at least N
elements and assigns the first N elements to the N elements of the LHS).

I like less that you're still looking at a library solution that only
handles std::tuple. Language unpacking/slicing handles *any tuple-like*
(on the RHS, and any whose get<N> returns a reference on the LHS).

--=20
Matthew

--=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/.

.
