220 18267 <1475047.29H4MbYzDs@tjmaciei-mobl4> article
Path: news.gmane.org!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Core Language feature: Multiple assignments
 from multiple return values via tuple
Date: Wed, 27 May 2015 15:55:51 -0700
Lines: 41
Approved: news@gmane.org
Message-ID: <1475047.29H4MbYzDs@tjmaciei-mobl4>
References: <69a59613-6504-466a-9878-786653d6087f@isocpp.org> <mk5biv$i41$1@ger.gmane.org> <476a56f8-8313-4b94-9cb7-628ff52ac803@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1432767364 26244 80.91.229.3 (27 May 2015 22:56:04 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 27 May 2015 22:56:04 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRB6UWTGVQKGQEZFMKUUI@isocpp.org Thu May 28 00:55:57 2015
Return-path: <std-proposals+bncBCB4TK757YBRB6UWTGVQKGQEZFMKUUI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lb0-f199.google.com ([209.85.217.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCB4TK757YBRB6UWTGVQKGQEZFMKUUI@isocpp.org>)
	id 1YxkEu-0003Cc-Ly
	for gclcip-std-proposals@m.gmane.org; Thu, 28 May 2015 00:55:56 +0200
Original-Received: by lbcak1 with SMTP id ak1sf6070493lbc.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 27 May 2015 15:55:56 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:to:subject:date:message-id:user-agent
         :in-reply-to:references:mime-version:content-type:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=kTLaa2TgPN6POYCIHG9H1plp8GUASHmfcrmxk2MC1KE=;
        b=b2WrZAjQEjfCgU45DTqcBBBtx6rKG1esT83bfciAcn7oOlcgHALkpfeVnXv2Hl6ktv
         BDeBOzlfQwdPiQLnRy8EQ+Gl4zkWcjgd7xcli17hPKO4ZkdPW0kfJJNVk6Zlg7WV5Mo+
         8N2LQTjq0dWblZ6Y/oR2mU4NFCksCc94u7rmMs8CdKmN/lDPdH06z0/5krgvQlhXp03H
         7A94LmOfVDIHiyv+EnZTEqZXushWo+gyMLtdgq8vOknINopkhGvrfuNiFaVoXqZakg3i
         w0X72bpUfGs3M9K6FvAU8BRcYjHHpxaqA06mqR1/sTgLVZgOwVXPFdB00Q4Pl+8p8V2T
         xUwA==
X-Gm-Message-State: ALoCoQn9/QLZylWmKBkfucx6ErYtjRKdF2vBFy43LHB8delQzANzDQy6XkPe/eAVr182NcFtrQsJ
X-Received: by 10.112.93.203 with SMTP id cw11mr34136730lbb.0.1432767356015;
        Wed, 27 May 2015 15:55:56 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.78.169 with SMTP id c9ls47801wix.3.gmail; Wed, 27 May 2015
 15:55:54 -0700 (PDT)
X-Received: by 10.194.143.75 with SMTP id sc11mr61399717wjb.62.1432767354535;
        Wed, 27 May 2015 15:55:54 -0700 (PDT)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [2a01:4f8:d13:f81:21c:14ff:fe01:12a3])
        by mx.google.com with ESMTP id di1si669885wjb.37.2015.05.27.15.55.54
        for <std-proposals@isocpp.org>;
        Wed, 27 May 2015 15:55:54 -0700 (PDT)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 2a01:4f8:d13:f81:21c:14ff:fe01:12a3 as permitted sender) client-ip=2a01:4f8:d13:f81:21c:14ff:fe01:12a3;
Original-Received: from tjmaciei-mobl4.localnet (jfdmzpr03-ext.jf.intel.com [134.134.139.72])
	by gondolin.macieira.info (Postfix) with ESMTPSA id 9449911A5C8
	for <std-proposals@isocpp.org>; Wed, 27 May 2015 15:55:53 -0700 (PDT)
User-Agent: KMail/4.14.6 (Linux/4.0.3-1-desktop; KDE/4.14.6; x86_64; ; )
In-Reply-To: <476a56f8-8313-4b94-9cb7-628ff52ac803@isocpp.org>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 2a01:4f8:d13:f81:21c:14ff:fe01:12a3
 as permitted sender) smtp.mail=thiago@macieira.org
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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:18267
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/18267>

On Wednesday 27 May 2015 15:09:33 Nicol Bolas wrote:
> We do have a similar concept: template parameter packs. It is one entity 
> which represents multiple objects. You can unpack them in arbitrary 
> expressions, which makes them much more useful than your limited `unpack` 
> tuple suggestion.

Actually, thinking about it and fold expressions allows for very easy 
unpacking. The unpack-tuple-and-call function would be:

template <typename F, typename... Args> auto
unpack(F &&f, std::tuple<Args...> &&args)
{
        using namespace std;
        return f(std::forward<Args>(get<N>(args)), ...);
}

So all we need is for the MRV pack to be treated like a template parameter 
pack and we can use all the expansion tricks.

	std::cout << ... << args << endl;
	size_t sum = 0 + ... + args;	// assuming they cast somehow to integer

	tuple<decltype(args)...> t = make_tuple(..., args);

If you have a template pack containing an MRV pack, you'll need the ....... 
operator...

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.
