220 8502 <628bba42-9a56-42d7-8182-0de7c10c437b@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Alex B <devalexb@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: Fri, 10 Jan 2014 07:35:15 -0800 (PST)
Lines: 125
Approved: news@gmane.org
Message-ID: <628bba42-9a56-42d7-8182-0de7c10c437b@isocpp.org>
References: <f4ec2cca-5951-447f-a938-0b2e5e3e233f@isocpp.org>	<-5123564187529511709@gmail297201516>	<52CB7506.1000906@gmail.com>	<CAOfiQqk4rRTRFX3dbcq33z2C190ZHUGRVUhM0WRJehPZEwFJ8g@mail.gmail.com>	<62bda680-3dd7-4be8-8ac5-0d2e08bf6d99@isocpp.org>	<CAOfiQq=fvi-mzf6mP4B2XBgCeHfimX857Jff+Nz=iUeHW5W1nw@mail.gmail.com>	<52CDFB2D.4050703@gmail.com>	<-9126987679220332623@gmail297201516>	<52CE0F54.5020800@gmail.com>	<CAOfiQqmi3UHRSvgQB_5ZdWrM3oRog4RpgsighU2a3p6HjoVq8g@mail.gmail.com>	<52CF3AB0.7090102@gmail.com>	<52CF3D80.9090702@gmail.com> <CAOfiQqkfdkKXTOX9J2kn9GB4KCzf3UbkGXcvqe+89ZEbB7X4Gw@mail.gmail.com>
 <52CF4DC0.20100@gmail.com>
 <031149b3-1c5b-4c6d-a827-82d29bc73d6f@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_349_5201527.1389368115307"
X-Trace: ger.gmane.org 1389368112 23119 80.91.229.3 (10 Jan 2014 15:35:12 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 10 Jan 2014 15:35:12 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC7JZJ43WYOBBNFGYCLAKGQECQV5STA@isocpp.org Fri Jan 10 16:35:20 2014
Return-path: <std-proposals+bncBC7JZJ43WYOBBNFGYCLAKGQECQV5STA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oa0-f72.google.com ([209.85.219.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC7JZJ43WYOBBNFGYCLAKGQECQV5STA@isocpp.org>)
	id 1W1e7B-0003E6-Mg
	for gclcip-std-proposals@m.gmane.org; Fri, 10 Jan 2014 16:35:18 +0100
Original-Received: by mail-oa0-f72.google.com with SMTP id o6sf17189280oag.11
        for <gclcip-std-proposals@m.gmane.org>; Fri, 10 Jan 2014 07:35:16 -0800 (PST)
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
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=UzLzgysTJZefAPp9e/W0UhLX4yQc9JrboZJbg4PsE/Y=;
        b=oaQ+EveWpzxx0QgcCEG/EGiPptRvZ6bMGkzkK1A+zFiIvcPDdiCO+1OC6gpLza1Qc8
         44b//COkcpVzloI/7LUFWS0zoSlQ12LiGGCcOkKQTFc+exTe7QebN/1N7pyOfsVjQyA1
         aRvVTDG/CgMhTU+zHymgSP5nI1WI0OxBkHFT0pQ/8J3vwcWkzn9Bba+5p1j24WVrcqhp
         K0Ht0wZWotJFWho0sS3UQI5xu5KsFCGON//x6JkDs99fGmJmSflx12lKGzQk+aqYxgca
         7sC0rrjyRCY+dsJAtjFWJFpUTD3wBCarZezHiboRF2nwzaMe6GeN5c6S8SW4LtrLl9pa
         guCQ==
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:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=UzLzgysTJZefAPp9e/W0UhLX4yQc9JrboZJbg4PsE/Y=;
        b=NFBXxkO0bRhH4ocXJg9fkM330F+s7rY7NluX9OWguwnOCetpSy/iFor2VS8VMVcJTw
         YPYmhS4RE+7AuDVOwGUeGIltQzhFusxgWTSg/DpsK2fXRNaH1HOUkijZdDeOH2o8iSt/
         Z99oRI5auGai79mvT6Qa9OgGd6GBDw9V8DXXAndOBRDPrYXGk1yZLO3xQnEKRuGshl0I
         n6sxzYlwrUBtz4PV8E4XaamZz4USgxTzPbNBmxTiDRZj393rgWVH4Grd7BFtbAOT3xk+
         DlGVrY6z3GAWjjQvbvuUMUzky5TAXICLPKL9RXaBPPoCN2xgSjlCmzn8kbC5Oh+ZVmxP
         DL1A==
X-Gm-Message-State: ALoCoQmg8hO+8zIFo+ENcg7Ub/d/EvknoJCBXiXgd5a2TRBCWsnAqjszKf/pkw2FJtGUW4rS5dTx
X-Received: by 10.42.46.3 with SMTP id i3mr797742icf.31.1389368116730;
        Fri, 10 Jan 2014 07:35:16 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.121.193 with SMTP id lm1ls529328obb.35.gmail; Fri, 10 Jan
 2014 07:35:15 -0800 (PST)
X-Received: by 10.182.183.74 with SMTP id ek10mr73975obc.21.1389368115870;
        Fri, 10 Jan 2014 07:35:15 -0800 (PST)
In-Reply-To: <031149b3-1c5b-4c6d-a827-82d29bc73d6f@isocpp.org>
X-Original-Sender: devalexb@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:8502
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8502>

------=_Part_349_5201527.1389368115307
Content-Type: text/plain; charset=ISO-8859-1

On Friday, January 10, 2014 5:01:31 AM UTC-5, Bengt Gustafsson wrote:

>  
>    template<...> struct HeadInfo;
>    template<typename T, ...> struct HeadInfo<T, ...> {
>        static const bool is_type = true;
>        typedef T type;
>    };
>    template<auto V, ...> struct HeadInfo<V, ...> {
>        static const bool is_type = false;
>        typedef decltype(V) type;
>        static const auto value = V;
>    };
>  
>
 
That syntax without ? would still require being able to name the generic 
pack. Your example should be:
 

template<typename T, ...*Tail*> struct HeadInfo<T, *Tail*...> {
static const bool is_type = true;
typedef T type;
};

 
 
Giving a name would be required to disambiguate cases where there is more 
than one generic pack:
 

template <...> struct A {};
 
template <class T, class U>
struct B;
 
template <...ElemsT, ...ElemsU>
struct B<A<ElemsT...>, A<ElemsU...>>
{
};

 
As for actual use cases (with or without ?), there is more 
than metaprogramming refactoring sugar. I can see at least one case that it 
would allow to fix which is boost recursive variants:
*http://www.boost.org/doc/libs/1_55_0/doc/html/boost/make_recursive_variant.html*<http://www.boost.org/doc/libs/1_55_0/doc/html/boost/make_recursive_variant.html>
Unless I'm wrong, recursive variants currently cannot contain a template 
type with non-type parameters, which is a bit annoying. This feature would 
make it possible.

-- 

--- 
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/.

------=_Part_349_5201527.1389368115307
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>On Friday, January 10, 2014 5:01:31 AM UTC-5, Bengt G=
ustafsson wrote:</div><blockquote style=3D"margin: 0px 0px 0px 0.8ex; paddi=
ng-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px=
; border-left-style: solid;" class=3D"gmail_quote"><div dir=3D"ltr"><div>&n=
bsp;</div><div>&nbsp; &nbsp;template&lt;...&gt; struct HeadInfo;</div><div>=
&nbsp; &nbsp;template&lt;typename T, ...&gt; struct HeadInfo&lt;T, ...&gt; =
{</div><div>&nbsp; &nbsp; &nbsp; &nbsp;static const bool is_type =3D true;<=
/div><div>&nbsp; &nbsp; &nbsp; &nbsp;typedef T type;</div><div>&nbsp; &nbsp=
;};</div><div>&nbsp; &nbsp;template&lt;auto V, ...&gt; struct HeadInfo&lt;V=
, ...&gt; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp;static const bool is_type =
=3D false;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;typedef decltype(V) type;</=
div><div>&nbsp; &nbsp; &nbsp; &nbsp;static const auto value =3D V;</div><di=
v>&nbsp; &nbsp;};</div><div>&nbsp;</div></div></blockquote><div>&nbsp;</div=
><div>That syntax without ? would still require being able to name the gene=
ric pack. Your example should be:</div><div>&nbsp;</div><blockquote style=
=3D"margin-right: 0px;" dir=3D"ltr"><div><font face=3D"courier new,monospac=
e">template&lt;typename T, ...<strong><font color=3D"#ff0000">Tail</font></=
strong>&gt; struct HeadInfo&lt;T, <strong><font color=3D"#ff0000">Tail</fon=
t></strong>...&gt; {</font></div><div><font face=3D"courier new,monospace">=
       static const bool is_type =3D true;</font></div><div><font face=3D"c=
ourier new,monospace">       typedef T type;</font></div><div><font face=3D=
"courier new,monospace">   };</font></div></blockquote><div>&nbsp;</div><di=
v>&nbsp;</div><div>Giving a name would be required to disambiguate cases wh=
ere there is more than one generic pack:</div><div>&nbsp;</div><blockquote =
style=3D"margin-right: 0px;" dir=3D"ltr"><div><font face=3D"courier new,mon=
ospace">template &lt;...&gt; struct A {};</font></div><div><font face=3D"co=
urier new,monospace"></font>&nbsp;</div><div><font face=3D"courier new,mono=
space">template &lt;class T, class U&gt;</font></div><div><font face=3D"cou=
rier new,monospace">struct B;</font></div><div><font face=3D"courier new,mo=
nospace"></font>&nbsp;</div><div><font face=3D"courier new,monospace">templ=
ate &lt;...ElemsT, ...ElemsU&gt;</font></div><div><font face=3D"courier new=
,monospace">struct B&lt;A&lt;ElemsT...&gt;, A&lt;ElemsU...&gt;&gt;</font></=
div><div><font face=3D"courier new,monospace">{</font></div><div><font face=
=3D"courier new,monospace">};</font></div></blockquote><div>&nbsp;</div><di=
v>As for actual use cases (with or without ?),&nbsp;there is more than&nbsp=
;metaprogramming refactoring sugar.&nbsp;I can see at least one case&nbsp;t=
hat it would allow to fix which is boost recursive variants:</div><div><a h=
ref=3D"http://www.boost.org/doc/libs/1_55_0/doc/html/boost/make_recursive_v=
ariant.html"><u><font color=3D"#0066cc">http://www.boost.org/doc/libs/1_55_=
0/doc/html/boost/make_recursive_variant.html</font></u></a></div><div>Unles=
s I'm wrong, recursive variants currently cannot contain a template type wi=
th non-type parameters, which is a bit annoying.&nbsp;This feature would ma=
ke it possible.</div></div>

<p></p>

-- <br />
&nbsp;<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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_349_5201527.1389368115307--

.
