220 35828 <e9825fff-7825-4b8e-85c4-bd006ceccc54@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: adrian.hawryluk@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Is there any proposal in the pipeline to allow any
 parameter in a template?
Date: Sat, 9 Dec 2017 12:12:35 -0800 (PST)
Lines: 144
Approved: news@gmane.org
Message-ID: <e9825fff-7825-4b8e-85c4-bd006ceccc54@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1937_1171370752.1512850355292"
X-Trace: blaine.gmane.org 1512850354 12372 195.159.176.226 (9 Dec 2017 20:12:34 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 9 Dec 2017 20:12:34 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCULLOGNUQIRBNEHWHIQKGQEZLQTAII@isocpp.org Sat Dec 09 21:12:30 2017
Return-path: <std-proposals+bncBCULLOGNUQIRBNEHWHIQKGQEZLQTAII@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f70.google.com ([209.85.213.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCULLOGNUQIRBNEHWHIQKGQEZLQTAII@isocpp.org>)
	id 1eNlU6-00031M-Ct
	for gclcip-std-proposals@m.gmane.org; Sat, 09 Dec 2017 21:12:30 +0100
Original-Received: by mail-vk0-f70.google.com with SMTP id s127sf7546676vkf.13
        for <gclcip-std-proposals@m.gmane.org>; Sat, 09 Dec 2017 12:12:37 -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:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=GI5x7glnQiWhxcx1LDyM5snWd1mtTJc0wd6G05DbAvI=;
        b=GfArx3Dcsw9kip6+SK+9Eo7MFPhYzMNyxWaGMfYuYNviDmbop/2XtAXaQaUJueKFm+
         bfPanBRgUfR3tnClXjv96c+iWGgKIEY6ADfgUASVFYyjUINVrxdxVP4lgSAuABGyluph
         1R1h9eJtCmlSz2foXVy0I72KptSgBW89UCsqApk4bfqA7SOyUmBRmnN4MGs3iQR0Rhv7
         KPdIG7wKVf5khW9lHFeQ/qadvjlbb3ii8T+Cvy2GtldGkPwVlj2VXJp/FdbuIZu2S6wt
         2XdneBBlJGx+ZKEVGR42+LqaYW0IM55wBM/5fy57WlY5oRE2OpIqMu22PldTfYZJ1x1t
         p/GA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=GI5x7glnQiWhxcx1LDyM5snWd1mtTJc0wd6G05DbAvI=;
        b=l47uDbrJnO1pEqEUHsccxhCJRa9B0toGMlM2BfbxuMwJ5ixrKCKfLNCHqukdJz4K35
         qVoOx4CR7RFAb1cu0QtVAGT+VlzMxYbCvc1/2FvdkpkL/O7PxMYTYBQMuDaQe4QVUwaQ
         CRQGJK1q3SxSxA0M5jv+QXjY8Hz+KsA+u07voV3Ck0CY3Oil+unsriRc+zswmhBw+cqL
         +CgrUsUg6lRcm4WbeluHtcXA9k/6gYxL/R8chFaZqNy6uuUoWKzGNoGYMdVBl/dvMkIe
         XhVzgOd2Ubo9bWgfTtRBsboZOzf7OmqPCjczxv/1CV7+hSQp16nndVsXTUc8XhI1eHNd
         +9iQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id: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=GI5x7glnQiWhxcx1LDyM5snWd1mtTJc0wd6G05DbAvI=;
        b=BYbm/3anB0TJt/BSWoWfLEpGvuXyU9DoLjmEJoPJst3qJjnRqY5u8iHxwBrfGDiImI
         IZroPFyTbrFIXTVi/YmjGu73aNldRheO05VDavfllCAK0oC5VW5Ga9Bxu5ZJcgZLvzQv
         iuUzZNR1QtTaW3vaS5B2D4X+thsLtBsc7rw3VjGDxOjOfR6LSuLSWcO/3Y6U2kPDGZyT
         WWotfzz484mGyuts0+I+ANhIMmlFuxZxwCabhk3/3LBofmYXa+LUT3xI0ErB9bHd0sJE
         JXAlV+SK6/YOYm5ua0Q+ahetGq321wNqFbGvawFcu8fd+A8Pf570i/K4tvf3zo28/T7i
         IugQ==
X-Gm-Message-State: AKGB3mIoVLA3EIzbu6u2CfclOyN/GFjA48jmn5bWC5VlTGDGiZ3/yY9W
	da8te5UB+rrcLykHjzf5qeuJhg==
X-Google-Smtp-Source: AGs4zMa88xKixvQjjb4znWG0qY07pjL03DOo04OwZCH9Nww1dYJBcXHzgnvID7TRFJlYSocMUpuPvQ==
X-Received: by 10.31.95.145 with SMTP id t139mr8177477vkb.124.1512850357427;
        Sat, 09 Dec 2017 12:12:37 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.170.205 with SMTP id t196ls53989vke.10.gmail; Sat, 09 Dec
 2017 12:12:36 -0800 (PST)
X-Received: by 10.31.2.148 with SMTP id 142mr1633288vkc.1.1512850355713;
        Sat, 09 Dec 2017 12:12:35 -0800 (PST)
X-Original-Sender: adrian.hawryluk@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:35828
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/35828>

------=_Part_1937_1171370752.1512850355292
Content-Type: multipart/alternative; 
	boundary="----=_Part_1938_1416133620.1512850355292"

------=_Part_1938_1416133620.1512850355292
Content-Type: text/plain; charset="UTF-8"

The problem with templates is that you must specify a particular item you 
want as a parameter, such as a `typename`, a `template` or a `value`. 
 However, you can't say, specialize the template based on if the next 
parameter is any of those three.

I propose that there be a way to specialize based on these parameters like 
in the following example:
    
    template <...Xs>
    struct X;

    template <template <typename...> class TT>
    struct X<TT> {};

    template <typename T>
    struct X<T> {};

    template <typename T, T I>
    struct X<I> {};

This would represent a template that takes a parameter pack of unspecified 
parameters, and is only accessible though specialization.

This allows the ability to have more control over template specialization 
while adding flexibility by allowing any parameter list. This on turn would 
allowing the creation of clearer and cleaner iinterfaces.

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e9825fff-7825-4b8e-85c4-bd006ceccc54%40isocpp.org.

------=_Part_1938_1416133620.1512850355292
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><span style=3D"font-size: 29.5346px;">The problem wit=
h templates is that you must specify a particular item you want as a parame=
ter, such as a `typename`, a `template` or a `value`. =C2=A0However, you ca=
n&#39;t say, specialize the template based on if the next parameter is any =
of those three.</span></div><div><span style=3D"font-size: 29.5346px;"><br>=
</span></div><div><span style=3D"font-size: 29.5346px;">I propose that ther=
e be a way to specialize based on these parameters like in the following ex=
ample:</span></div><div><span style=3D"font-size: 29.5346px;">=C2=A0 =C2=A0=
 </span></div><div class=3D"prettyprint" style=3D"background-color: rgb(250=
, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-=
width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">template</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;=
....</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Xs</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> X</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">template</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">template</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">typename</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">...&gt;</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 TT</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">str=
uct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> X</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">TT</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">{};</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">template</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> X</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">T</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{};</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">template</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">typename</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> T I</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> X</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">I</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{};</span></div></code></div=
><div><br></div><div><span style=3D"font-size: 29.5346px;">This would repre=
sent a template that takes a parameter pack of unspecified parameters, and =
is only accessible though specialization.</span></div><div><span style=3D"f=
ont-size: 29.5346px;"><br></span></div><div><span style=3D"font-size: 29.53=
46px;">This allows the ability to have more control over template specializ=
ation while adding flexibility by allowing any parameter list. This on turn=
 would allowing the creation of clearer and cleaner iinterfaces.</span></di=
v><div><br></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/e9825fff-7825-4b8e-85c4-bd006ceccc54%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e9825fff-7825-4b8e-85c4-bd006ceccc54=
%40isocpp.org</a>.<br />

------=_Part_1938_1416133620.1512850355292--

------=_Part_1937_1171370752.1512850355292--

.
