220 36210 <5088a543-efd6-4944-8a4c-0981cc33db55@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Mingxin Wang <wmx16835vv@163.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Make aliased templates first class citizens
Date: Thu, 21 Dec 2017 06:14:15 -0800 (PST)
Lines: 112
Approved: news@gmane.org
Message-ID: <5088a543-efd6-4944-8a4c-0981cc33db55@isocpp.org>
References: <8e4dd67b-e929-4f83-8f68-4a7ebd20a4e3@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_5292_382028347.1513865655504"
X-Trace: blaine.gmane.org 1513865540 16472 195.159.176.226 (21 Dec 2017 14:12:20 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 21 Dec 2017 14:12:20 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDNMBNHJWIGBBOED57IQKGQEZTZNVFQ@isocpp.org Thu Dec 21 15:12:16 2017
Return-path: <std-proposals+bncBDNMBNHJWIGBBOED57IQKGQEZTZNVFQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f197.google.com ([209.85.217.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDNMBNHJWIGBBOED57IQKGQEZTZNVFQ@isocpp.org>)
	id 1eS1a3-0003vK-F3
	for gclcip-std-proposals@m.gmane.org; Thu, 21 Dec 2017 15:12:15 +0100
Original-Received: by mail-ua0-f197.google.com with SMTP id i45sf15489396uaa.9
        for <gclcip-std-proposals@m.gmane.org>; Thu, 21 Dec 2017 06:14:18 -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: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;
        bh=AarxQ+HmfC530ZUAOf+F0igyPIccIQuHZKXXbI078gk=;
        b=cc6olbzLsDlZnZdspWtAgHCGcwuH0kHGV9EQ2rTeAMSgTsQZSmCC0zS1ZWWefdO8Fd
         J0bV6SXuyFu4zHPBs+9LtR+344yghLEKyQDxbqIV1Ys3VGCp5Gl1L8WvyLOMT1aFeTUM
         S2YjuTf+9r/NAjGBX6dpWwmKK0NRPxECxNmlXGNuRuArq5n4CWWIfjxSAG4Irh7LOYP6
         dQyUEfyryDG/T2QLcj3coIxUuQmdbOxfQCOwjX23Q7LKROfXh6puxRW5/Rit5b/pclbZ
         MDtGaRFFwW4qRlvkDn0G1m0bViLrZQwXeK/UlBbFY05k0+Huoi3yw5EaUVhBCWSFBrrh
         O/DQ==
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:in-reply-to:references
         :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=AarxQ+HmfC530ZUAOf+F0igyPIccIQuHZKXXbI078gk=;
        b=pKlMtHBhMPXobbrqPjmtL4lGdZF2VvG+oG2Y5TMNX/kMEiDjyZuFTEvtGEqirqv85u
         G02tyoBvhQF9BMO8mu6N7Tgs49JRfMfjQ6GaE1uaffOSi6UW6Ug3H0JShcpnTpAGU2dD
         OGi6xxR1roO2Axnc16D2LcDNrxRJDhLIKxOGTkc/wloMLoxqr/DTSmb61zHJY+MLrOw3
         9NGWjFFmvilizvd0kNAsBuGsNdX5fCSWZL1ITiBKOuKCgLSqfUsp4SO3iAVPoprhko7l
         lPbv7A4f3Jtdi59lj/5/Fsu2fngYW538YrVvmzRgXkFqNMtCxbcC3A7Cur9SHWSPyUZL
         tzfg==
X-Gm-Message-State: AKGB3mL8ncK4k9+2VM4hi/bOC1hpeE0cDqkcsPpslIcJazSRPzy5/kQe
	k9/XfwrjkfUz3U+Yk1OStf8gyw==
X-Google-Smtp-Source: ACJfBou0BCsiolAPrHmSm19DHdv6nT1ERo69+oQviR+5qA/JpDY7mK/xOe9BfumNq7AhT1VMlkCUow==
X-Received: by 10.31.238.130 with SMTP id m124mr4944173vkh.80.1513865657852;
        Thu, 21 Dec 2017 06:14:17 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.174.76 with SMTP id x73ls90544vke.21.gmail; Thu, 21 Dec
 2017 06:14:16 -0800 (PST)
X-Received: by 10.31.192.135 with SMTP id q129mr998740vkf.0.1513865655995;
        Thu, 21 Dec 2017 06:14:15 -0800 (PST)
In-Reply-To: <8e4dd67b-e929-4f83-8f68-4a7ebd20a4e3@isocpp.org>
X-Original-Sender: wmx16835vv@163.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:36210
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36210>

------=_Part_5292_382028347.1513865655504
Content-Type: multipart/alternative; 
	boundary="----=_Part_5293_588116073.1513865655504"

------=_Part_5293_588116073.1513865655504
Content-Type: text/plain; charset="UTF-8"

As far as I am concerned, this feature could be mainly used on specifying 
template arguments in separated semantic levels.

On the one hand, I think the motivation of this idea is probably 
not sufficient enough for a *core language feature*. After all, this is a 
pattern in compile-time programming and could be easily implemented with 
struct templates (as illustrated in the initial post), and I did not see 
the peculiarities of this pattern so that it need support at the language 
level.

On the other hand, as other feedback reports, this feature introduces a new 
language-level concept - template of template, which is at the same level 
as the concepts of "types" and "type templates". If this concept is 
standardized, a number of clauses may be reappraised. For example, should 
"template of template" be a valid template argument type? Is it allowed to 
declare a type or function template with templates in multiple layer?

Actually, I have handled some cases that required specifying a type 
template in multiple separated semantic levels, and I found it acceptable 
to design a helper struct (or class) template as a "*configurator*", e.g.:

template <class T, class Alloc, std::size_t SOO>
class Aaa; // requires concept Bbb

template <class Alloc, std::size_t SOO>
struct AaaConfigurator {
  template <class T>
  using type = Aaa<T, Alloc, SOO>;
};

template <template <class> class BbbTemplate>
class BbbUser;

template <class Alloc = DefaultAlloc, std::size_t SOO = 
alignof(std::max_align_t)>
using AaaUser = BbbUser<AaaConfigurator<Alloc, SOO>::template type>;

Mingxin Wang

-- 
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/5088a543-efd6-4944-8a4c-0981cc33db55%40isocpp.org.

------=_Part_5293_588116073.1513865655504
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>As far as I am concerned, this feature could be mainl=
y used on specifying template arguments in separated semantic levels.</div>=
<div><br></div>On the one hand, I think the motivation of this idea is prob=
ably not=C2=A0sufficient enough for a <i>core language feature</i>. After a=
ll, this is a pattern in compile-time programming and could be easily imple=
mented with struct templates (as illustrated in the initial post), and I di=
d not see the peculiarities of this pattern so that it need support at the =
language level.<div><br></div><div>On the other hand, as other feedback rep=
orts, this feature introduces a new language-level concept - template of te=
mplate, which is at the same level as the concepts of &quot;types&quot; and=
 &quot;type templates&quot;. If this concept is standardized, a number of=
=C2=A0clauses may be reappraised. For example, should &quot;template of tem=
plate&quot; be a valid template argument type? Is it allowed to declare a t=
ype or function template with templates in multiple layer?</div><div><br></=
div><div>Actually, I have handled some cases that required specifying a typ=
e template in multiple separated semantic levels, and I found it acceptable=
 to design a helper struct (or class) template as a &quot;<i>configurator</=
i>&quot;, e.g.:</div><div><br></div><div><div class=3D"prettyprint" style=
=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background=
-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><font color=3D"#660066"><div class=3D"subprettyprint">template =
&lt;class T, class Alloc, std::size_t SOO&gt;</div><div class=3D"subprettyp=
rint">class Aaa; // requires concept Bbb</div><div class=3D"subprettyprint"=
><br></div><div class=3D"subprettyprint">template &lt;class Alloc, std::siz=
e_t SOO&gt;</div><div class=3D"subprettyprint">struct AaaConfigurator {</di=
v><div class=3D"subprettyprint">=C2=A0 template &lt;class T&gt;</div><div c=
lass=3D"subprettyprint">=C2=A0 using type =3D Aaa&lt;T, Alloc, SOO&gt;;</di=
v><div class=3D"subprettyprint">};</div><div class=3D"subprettyprint"><br><=
/div><div class=3D"subprettyprint">template &lt;template &lt;class&gt; clas=
s BbbTemplate&gt;</div><div class=3D"subprettyprint">class BbbUser;</div><d=
iv class=3D"subprettyprint"><br></div><div class=3D"subprettyprint">templat=
e &lt;class Alloc =3D DefaultAlloc, std::size_t SOO =3D alignof(std::max_al=
ign_t)&gt;</div><div class=3D"subprettyprint">using AaaUser =3D BbbUser&lt;=
AaaConfigurator&lt;Alloc, SOO&gt;::template type&gt;;</div></font></div></c=
ode></div><br>Mingxin Wang</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/5088a543-efd6-4944-8a4c-0981cc33db55%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5088a543-efd6-4944-8a4c-0981cc33db55=
%40isocpp.org</a>.<br />

------=_Part_5293_588116073.1513865655504--

------=_Part_5292_382028347.1513865655504--

.
