220 8419 <52CB7506.1000906@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: A new keyword for either a type or a variable
 (typical use case for variadic template template)?
Date: Tue, 07 Jan 2014 11:31:18 +0800
Lines: 65
Approved: news@gmane.org
Message-ID: <52CB7506.1000906@gmail.com>
References: <f4ec2cca-5951-447f-a938-0b2e5e3e233f@isocpp.org> <-5123564187529511709@gmail297201516>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
X-Trace: ger.gmane.org 1389065491 30248 80.91.229.3 (7 Jan 2014 03:31:31 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 7 Jan 2014 03:31:31 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBFXKVWLAKGQEWENMZJI@isocpp.org Tue Jan 07 04:31:37 2014
Return-path: <std-proposals+bncBCW25A7E3QCRBFXKVWLAKGQEWENMZJI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f200.google.com ([209.85.223.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBFXKVWLAKGQEWENMZJI@isocpp.org>)
	id 1W0NOB-0000HK-RO
	for gclcip-std-proposals@m.gmane.org; Tue, 07 Jan 2014 04:31:36 +0100
Original-Received: by mail-ie0-f200.google.com with SMTP id at1sf97732519iec.3
        for <gclcip-std-proposals@m.gmane.org>; Mon, 06 Jan 2014 19:31:34 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=ssK1SvlFPSVwc63ZqeroxJnkGzEcbkrx/YlD0qvlobQ=;
        b=czzhudNqgJD/OdR6UQuelzqrw5XtCeMu9DDVVE6Q+Kht7yU52Q1f8nzfz5clEbGvBT
         9TSHMkVpKVswnwo6fpi8XukFphkPYaxbW6hp5t9OwkNnAWVsT5EnHijFnqbGwlmX+tnF
         hFGI4lBjMLZuy/a/hzBdoliMH715aB5rSB7jvV5Nw7r/MjZ3BelOz2mu9iKQy9HBJzPK
         CAWp/zS9OlcwL2hPSNJezuCJjCmETe7GcSoT1TvVgDxvoxl0mR34vJ/A+ZvW25Pu84yP
         rv5KRkYkOIjJTmeppakDCA9g82XbwSeQ4vf9a13/xl8bNlhwYjiA9auIx4ST1wvtGKnp
         T+Ww==
X-Gm-Message-State: ALoCoQlZHlcR1Ob6LdHKKKUAyr7FMbbsOBVxI2KiwDXTMAWa85cdVYh1TlTF3KkKAqTvImKMeFKG
X-Received: by 10.182.251.230 with SMTP id zn6mr45536810obc.14.1389065494791;
        Mon, 06 Jan 2014 19:31:34 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.60.37 with SMTP id e5ls6042785qer.84.gmail; Mon, 06 Jan
 2014 19:31:34 -0800 (PST)
X-Received: by 10.236.51.71 with SMTP id a47mr46317639yhc.22.1389065494069;
        Mon, 06 Jan 2014 19:31:34 -0800 (PST)
Original-Received: from mail-ob0-x235.google.com (mail-ob0-x235.google.com [2607:f8b0:4003:c01::235])
        by mx.google.com with ESMTPS id t39si18388836yhp.250.2014.01.06.19.31.34
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Mon, 06 Jan 2014 19:31:34 -0800 (PST)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:4003:c01::235 as permitted sender) client-ip=2607:f8b0:4003:c01::235;
Original-Received: by mail-ob0-f181.google.com with SMTP id uy5so19504347obc.12
        for <std-proposals@isocpp.org>; Mon, 06 Jan 2014 19:31:33 -0800 (PST)
X-Received: by 10.182.28.134 with SMTP id b6mr74792212obh.27.1389065493681;
        Mon, 06 Jan 2014 19:31:33 -0800 (PST)
Original-Received: from Davids-MacBook-Pro.local ([121.54.54.62])
        by mx.google.com with ESMTPSA id m4sm103088528oen.7.2014.01.06.19.31.28
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Mon, 06 Jan 2014 19:31:32 -0800 (PST)
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
In-Reply-To: <-5123564187529511709@gmail297201516>
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:4003:c01::235 as permitted
 sender) smtp.mail=potswa@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (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-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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:8419
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8419>

On 1/7/14 10:17 AM, Richard Smith wrote:
> Rather than introducing a new keyword, you could use a '?' token:
>
>    template<template<? ...> class A, ? ... Ts> void f(A<Ts...>);
>
> (or a '*' token, or something similar).

This idea is unscalable if the ? represents a particular template 
parameter list. If there were two template template parameters with 
different lists, you would end up attempting to assign both to ? .

I'm pretty sure I wrote something about the issue on this board a while 
ago, but can't recall the details.

A bare ellipsis seems to make it clearer that there is no underlying 
storage or meta-variable.

template<template<...> class A, ... Ts> void f(A<Ts...>);


In this case, the template parameter list of A and the argument 
types/kinds of Ts are deduced separately, and conversion potentially 
occurs when forming A<Ts...> . No expressiveness is lost versus the "?" 
syntax because names at the call site are determined to refer to types 
or objects independently of the template parameter list, so ? would not 
pass any information back to the user anyway.

> The 'auto' keyword would make sense here, but it might make more sense
> being restricted to a non-type template parameter (with its type deduced
> from the template argument). Perhaps it could be made to fill both roles:

As for the non-type role, that sounds nice as a separate proposal. The 
standard explicitly mentions that it's impossible to pass a non-type 
argument and deduce its type, and it makes usage of e.g. 
std::integral_constant repetitive.

>
>    template<auto X> void f() {
>      int a = X; // it's a value by default
>    }
>    template<auto X> void g() {
>      typename X y; // it can be explicitly treated as a type
>    }
>    template<auto X> void h() {
>      template X<int> z; // or as a template
>    }
>    template<auto &X> void i(); // not exactly 'auto', always a non-type
> template parameter
>
> ... though this would require a lot of hacking with the grammar, to allow
> 'template' and 'typename' in these new places.

Looks like a solution in search of a problem. Every use of the parameter 
would have to be disambiguated, and since the parameter can only refer 
to the typename or object passed by the caller, each disambiguation 
would have to go the same way. Might as well keep the status quo.

-- 

--- 
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/.

.
