220 39626 <0b82cc47-9dd1-41f1-80b4-3e1469aaa9a9@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: inkwizytoryankes@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Why are concepts restricted to namespace-scope?
Date: Fri, 10 Aug 2018 00:24:57 -0700 (PDT)
Lines: 418
Approved: news@gmane.org
Message-ID: <0b82cc47-9dd1-41f1-80b4-3e1469aaa9a9@isocpp.org>
References: <3825544b-b617-4a0e-a02d-a5041d989c15@isocpp.org>
 <93c917bb-1c8d-405d-80e9-4fe036af1a58@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_638_172201033.1533885897630"
X-Trace: blaine.gmane.org 1533885773 24736 195.159.176.226 (10 Aug 2018 07:22:53 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 10 Aug 2018 07:22:53 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDDLTAGNTIBBBSX3WTNQKGQEYY5YOEA@isocpp.org Fri Aug 10 09:22:49 2018
Return-path: <std-proposals+bncBDDLTAGNTIBBBSX3WTNQKGQEYY5YOEA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw1-f72.google.com ([209.85.161.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDDLTAGNTIBBBSX3WTNQKGQEYY5YOEA@isocpp.org>)
	id 1fo1l3-0006M1-50
	for gclcip-std-proposals@m.gmane.org; Fri, 10 Aug 2018 09:22:49 +0200
Original-Received: by mail-yw1-f72.google.com with SMTP id 133-v6sf11800613ywq.4
        for <gclcip-std-proposals@m.gmane.org>; Fri, 10 Aug 2018 00:25:00 -0700 (PDT)
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=hwo6aaVOQAmmkNh4UOGZA7o9cKwtWLh3LG+/YM2ECoY=;
        b=Z+HzW6H6Ee/dd7O7pwv511+FRbG1tphm9KswCtQWwi3PkoIy8VS8673ga7fuLp+GXB
         EnhnikeUbbZ/A0TvhQhSlzQkE3T/4U4LGjUKVa0T4QBrnCh3g4ys1TKC0koXqG71lHdW
         0j+FFey1Dte2AHzr9FY9LQ4eIJAZLGO5v3BhnoOWlGlKGIOgYlgh3KwsmYEtANPHWCUU
         y3inW1Z9yFLOpD5Fhi4r4QvCmS3nrFI5kV3xXhPsiqJmlOPeM4AAsQ2Z9RKfyJAoiqY9
         lSyoT0fosha+6+dsCxuxHbBiJNYg6Kqhah+/nU5aCzc4rWEKWcEvtgWHfRxXftnrC1Fo
         DN6w==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        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=hwo6aaVOQAmmkNh4UOGZA7o9cKwtWLh3LG+/YM2ECoY=;
        b=bKsCTVyG0FDwRJntVZWxnILn4AMOB0fcE9glackUtdlaPRvfnq15BR4M9qVSkYyKF7
         QQjWuHwk2uJlI12wNRi9NkdOSwHLXGz/ELPpYBF+4tUAuQlLyKkyhOZBvAHEUd4xSx86
         1prVSG+4XhE2QGskmToH/Yhnu2buXVC0bP0ywqmWn0kydcGbaaY0TcCaDr4umOTYDp2b
         DOwOewjVNboWXqS5o5nhPvhQlAvDz2dK6Oo55MYr/4bUV/n6FXkuYC+UjocoWId7DusB
         1J0XsyfRpgkJTYJg9b8QWYTxc4Nc8xnF7c7Mf9IqqlPudqmk0HuIoNi+p75+1t1Z8ly0
         2A3Q==
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=hwo6aaVOQAmmkNh4UOGZA7o9cKwtWLh3LG+/YM2ECoY=;
        b=kDE4ugkJdp6ClHX98FxcDzYtgR+D1cvkD6bHpvD7RcRSeMgN6T8I16L5BNt04k6ZGG
         7hnsW6FOd82Q4DwB1yUwY+tYZJEhTnD2FKMRZh+8OB10cyZxPMgTPJNQroFfR8+nK8zD
         u9OesPuiyolnQFL1ZO5OU+bxiX9JNDBcS0QlpNXpIKotNq7oUg4TDymzBvS0/WtmvD7w
         uo2EcSIQLeYxeR+E5qmatk+U/BXbkabDIV0ww7gGnFilnuT4/hdftL3hY5zSaxZLqaEx
         DYzIRoui0p+MSwOAG5Z0HiZVWhuVy4QietkIAS9ByOUMnqeqrcNazaJouze80MtW0ywi
         1quQ==
X-Gm-Message-State: AOUpUlFZtH0DURWE0l5gA+YwSEEGY72w2w4fd+HVYg13nol9mfL73a7v
	SoiqfVwVQqxWsMkqiRcAAry3GA==
X-Google-Smtp-Source: AA+uWPwv35Dt0TrFNl1am1LaYWTDn4++sLwfQ3nlR/D67oqRjcEAWHcKspOwTEyq/3s/jgZZpFtpJg==
X-Received: by 2002:a25:8592:: with SMTP id x18-v6mr831192ybk.14.1533885899575;
        Fri, 10 Aug 2018 00:24:59 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a81:98cc:: with SMTP id p195-v6ls1690910ywg.2.gmail; Fri, 10
 Aug 2018 00:24:58 -0700 (PDT)
X-Received: by 2002:a0d:cb03:: with SMTP id n3-v6mr128014ywd.0.1533885898371;
        Fri, 10 Aug 2018 00:24:58 -0700 (PDT)
In-Reply-To: <93c917bb-1c8d-405d-80e9-4fe036af1a58@isocpp.org>
X-Original-Sender: inkwizytoryankes@gmail.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:39626
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/39626>

------=_Part_638_172201033.1533885897630
Content-Type: multipart/alternative; 
	boundary="----=_Part_639_388732386.1533885897631"

------=_Part_639_388732386.1533885897631
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



On Friday, August 10, 2018 at 3:53:26 AM UTC+2, Arthur O'Dwyer wrote:
>
> On Wednesday, August 8, 2018 at 10:07:24 PM UTC-7, Justin Bassett wrote:
>>
>> I recently discovered that concepts must be defined at namespace scope.=
=20
>> What is the reason for this? It seems like an arbitrary restriction to m=
e,=20
>> when alias templates and variable templates can appear at class scope.
>>
>> This realization came from thinking about passing concepts as template=
=20
>> parameters. It currently is not possible. Template parameters can't be=
=20
>> concepts; they can only be template template (type) parameters, type=20
>> parameters, or value parameters. Wrapping the concept inside a struct=20
>> doesn't work as well, since the concept must be defined at namespace sco=
pe.
>>
>
>
> Here's an example involving "member concept aliases" that I worked up the=
=20
> other day on Slack:
>
> struct One {
>     template<Red T> static void f(T);
>     template<class T> using concept concept_ =3D Red<T>;
> };
> struct Two {
>     template<Blue T> static void f(T);
>     template<class T> using concept concept_ =3D Blue<T>;
> };
>
> template<class Meta, class T> requires(Meta::template concept_<T>)
> void hooray(T t) {
>     return Meta::f(t);
> }
>
> // ...
> hooray<One>(a_red_thing);
> hooray<Two>(a_blue_thing);
>
> (It occurred to me that it is very convenient how neither `type` nor=20
> `value` is a reserved word in C++; and that it is corresponding unfortuna=
te=20
> that `concept` *will* be a keyword. Notice the use of `concept_` above.)
>
> Casey Carter pointed out that *almost* the same effect can be achieved vi=
a
>
> struct One {
>     template<Red T> static void f(T);
> };
> struct Two {
>     template<Blue T> static void f(T);
> };
>
> template<class Meta, class T> requires requires (T t) { Meta::f(t); }
> void hooray(T t) {
>     return Meta::f(t);
> }
>
> // ...
> hooray<One>(a_red_thing);
> hooray<Two>(a_blue_thing);
>
> The difference between the "concept" approach and the "anonymous=20
> requires-clause" approach has to do with subsumption rules.
> Also, this smells a lot like smuggling a concept (e.g. `Red`) through a=
=20
> function declaration (`One::f`), i.e., a sneaky technical workaround for =
a=20
> missing feature in the language, analogous to how we used to have to=20
> smuggle variable templates through class templates (e.g. every type-trait=
=20
> ever).
>
> If you're willing to forgo subsumption (which I personally am, AFAIK),=20
> then you can already achieve the goal of "member concepts" by simply=20
> rewriting all your concepts as plain old variable templates. To the exten=
t=20
> that this doesn't work, it shows why we might want to add real member=20
> concepts and concept aliases. To the extent that this does work, it shows=
=20
> why we don't technically need the `concept` keyword at all.
>
> struct One {
>     template<Red T> static void f(T);
>     template<class T> static constexpr bool concept_ =3D Red<T>;
> };
> struct Two {
>     template<Blue T> static void f(T);
>     template<class T> static constexpr bool concept_ =3D Blue<T>;
> };
>
> template<class Meta, class T> requires Meta::template concept_<T>
> void hooray(T t) {
>     return Meta::f(t);
> }
>
> // ...
> hooray<One>(a_red_thing);
> hooray<Two>(a_blue_thing);
>
> Here's the example, complete and compilable.=20
> <https://wandbox.org/permlink/ySWp3QWnqWIxylQN>
>
> =E2=80=93Arthur
>

Probably one thing that prevent this usage is that `concept_` concept isn't=
=20
concept at least when `hooray` is parsed, you will need use prefix=20
`concept` to allow correct parsing of this code (same as you need use=20
`template` or `typename`).

Another thing, why not use `some_concept<M, T>`?

Overall I think this was deliberately done to simplify whole design and=20
avion any unexpected iterations, It would be bad if concepts skyrocket to=
=20
level of template metaprograming from beginning, AFAIK right now you can't=
=20
do any arbitrary ordering of concepts that depends on metaprograming and=20
this is good thing.

--=20
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 e=
mail 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/0b82cc47-9dd1-41f1-80b4-3e1469aaa9a9%40isocpp.or=
g.

------=_Part_639_388732386.1533885897631
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Friday, August 10, 2018 at 3:53:26 AM UTC+2, Ar=
thur O&#39;Dwyer wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div di=
r=3D"ltr">On Wednesday, August 8, 2018 at 10:07:24 PM UTC-7, Justin Bassett=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I recently =
discovered that concepts must be defined at namespace scope. What is the re=
ason for this? It seems like an arbitrary restriction to me, when alias tem=
plates and variable templates can appear at class scope.<div><br></div><div=
>This realization came from thinking about passing concepts as template par=
ameters. It currently is not possible. Template parameters can&#39;t be con=
cepts; they can only be template template (type) parameters, type parameter=
s, or value parameters. Wrapping the concept inside a struct doesn&#39;t wo=
rk as well, since the concept must be defined at namespace scope.</div></di=
v></blockquote><div><br></div><div><br></div><div>Here&#39;s an example inv=
olving &quot;member concept aliases&quot; that I worked up the other day on=
 Slack:</div><div><br></div><div><div style=3D"background-color:rgb(250,250=
,250);border:1px solid rgb(187,187,187);word-wrap:break-word"><code><div><s=
pan style=3D"color:#008">struct</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#606">One</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
</span><span style=3D"color:#008">template</span><span style=3D"color:#660"=
>&lt;</span><span style=3D"color:#606">Red</span><span style=3D"color:#000"=
> T</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#000">=
 </span><span style=3D"color:#008">static</span><span style=3D"color:#000">=
 </span><span style=3D"color:#008">void</span><span style=3D"color:#000"> f=
</span><span style=3D"color:#660">(</span><span style=3D"color:#000">T</spa=
n><span style=3D"color:#660">);</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 </span><span style=3D"color:#008">template</span><span style=3D"col=
or:#660">&lt;</span><span style=3D"color:#008">class</span><span style=3D"c=
olor:#000"> T</span><span style=3D"color:#660">&gt;</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#008">using</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#008">concept</span><span style=3D"co=
lor:#000"> concept_ </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Red</span><span style=3D=
"color:#660">&lt;</span><span style=3D"color:#000">T</span><span style=3D"c=
olor:#660">&gt;;</span><span style=3D"color:#000"><br></span><span style=3D=
"color:#660">};</span><span style=3D"color:#000"><br></span><span style=3D"=
color:#008">struct</span><span style=3D"color:#000"> </span><span style=3D"=
color:#606">Two</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span =
style=3D"color:#008">template</span><span style=3D"color:#660">&lt;</span><=
span style=3D"color:#606">Blue</span><span style=3D"color:#000"> T</span><s=
pan style=3D"color:#660">&gt;</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#008">static</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#008">void</span><span style=3D"color:#000"> f</span><span=
 style=3D"color:#660">(</span><span style=3D"color:#000">T</span><span styl=
e=3D"color:#660">);</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </sp=
an><span style=3D"color:#008">template</span><span style=3D"color:#660">&lt=
;</span><span style=3D"color:#008">class</span><span style=3D"color:#000"> =
T</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#008">using</span><span style=3D"color:#000"> </=
span><span style=3D"color:#008">concept</span><span style=3D"color:#000"> c=
oncept_ </span><span style=3D"color:#660">=3D</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#606">Blue</span><span style=3D"color:#660=
">&lt;</span><span style=3D"color:#000">T</span><span style=3D"color:#660">=
&gt;;</span><span style=3D"color:#000"><br></span><span style=3D"color:#660=
">};</span><span style=3D"color:#000"><br><br></span><span style=3D"color:#=
008">template</span><span style=3D"color:#660">&lt;</span><span style=3D"co=
lor:#008">class</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#606">Meta</span><span style=3D"color:#660">,</span><span style=3D"color=
:#000"> </span><span style=3D"color:#008">class</span><span style=3D"color:=
#000"> T</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#=
000"> requires</span><span style=3D"color:#660">(</span><span style=3D"colo=
r:#606">Meta</span><span style=3D"color:#660">::</span><span style=3D"color=
:#008">template</span><span style=3D"color:#000"> concept_</span><span styl=
e=3D"color:#660">&lt;</span><span style=3D"color:#000">T</span><span style=
=3D"color:#660">&gt;)</span><span style=3D"color:#000"><br></span><span sty=
le=3D"color:#008">void</span><span style=3D"color:#000"> hooray</span><span=
 style=3D"color:#660">(</span><span style=3D"color:#000">T t</span><span st=
yle=3D"color:#660">)</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span=
><span style=3D"color:#008">return</span><span style=3D"color:#000"> </span=
><span style=3D"color:#606">Meta</span><span style=3D"color:#660">::</span>=
<span style=3D"color:#000">f</span><span style=3D"color:#660">(</span><span=
 style=3D"color:#000">t</span><span style=3D"color:#660">);</span><span sty=
le=3D"color:#000"><br></span><span style=3D"color:#660">}</span><span style=
=3D"color:#000"><br><br></span><span style=3D"color:#800">// ...</span><spa=
n style=3D"color:#000"><br>hooray</span><span style=3D"color:#660">&lt;</sp=
an><span style=3D"color:#606">One</span><span style=3D"color:#660">&gt;(</s=
pan><span style=3D"color:#000">a_red_thing</span><span style=3D"color:#660"=
>);</span><span style=3D"color:#000"><br>hooray</span><span style=3D"color:=
#660">&lt;</span><span style=3D"color:#606">Two</span><span style=3D"color:=
#660">&gt;(</span><span style=3D"color:#000">a_blue_thing</span><span style=
=3D"color:#660">);</span></div></code></div><div><br></div></div><div>(It o=
ccurred to me that it is very convenient how neither `type` nor `value` is =
a reserved word in C++; and that it is corresponding unfortunate that `conc=
ept` <i>will</i> be a keyword. Notice the use of `concept_` above.)</div><d=
iv><br></div><div>Casey Carter pointed out that <i>almost</i> the same effe=
ct can be achieved via</div><div><br></div><div><div style=3D"background-co=
lor:rgb(250,250,250);border:1px solid rgb(187,187,187);word-wrap:break-word=
"><code><div><span style=3D"color:#008">struct</span><span style=3D"color:#=
000"> </span><span style=3D"color:#606">One</span><span style=3D"color:#000=
"> </span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br=
>=C2=A0 =C2=A0 </span><span style=3D"color:#008">template</span><span style=
=3D"color:#660">&lt;</span><span style=3D"color:#606">Red</span><span style=
=3D"color:#000"> T</span><span style=3D"color:#660">&gt;</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">static</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">void</span><span style=
=3D"color:#000"> f</span><span style=3D"color:#660">(</span><span style=3D"=
color:#000">T</span><span style=3D"color:#660">);</span><span style=3D"colo=
r:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"color=
:#000"><br></span><span style=3D"color:#008">struct</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#606">Two</span><span style=3D"color=
:#000"> </span><span style=3D"color:#660">{</span><span style=3D"color:#000=
"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">template</span><span =
style=3D"color:#660">&lt;</span><span style=3D"color:#606">Blue</span><span=
 style=3D"color:#000"> T</span><span style=3D"color:#660">&gt;</span><span =
style=3D"color:#000"> </span><span style=3D"color:#008">static</span><span =
style=3D"color:#000"> </span><span style=3D"color:#008">void</span><span st=
yle=3D"color:#000"> f</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">T</span><span style=3D"color:#660">);</span><span style=3D"=
color:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"c=
olor:#000"><br><br></span><span style=3D"color:#008">template</span><span s=
tyle=3D"color:#660">&lt;</span><span style=3D"color:#008">class</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#606">Meta</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">class</span><span style=3D"color:#000"> T</span><span style=
=3D"color:#660">&gt;</span><span style=3D"color:#000"> requires requires </=
span><span style=3D"color:#660">(</span><span style=3D"color:#000">T t</spa=
n><span style=3D"color:#660">)</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#660">{</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#606">Meta</span><span style=3D"color:#660">::</span><span sty=
le=3D"color:#000">f</span><span style=3D"color:#660">(</span><span style=3D=
"color:#000">t</span><span style=3D"color:#660">);</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660">}</span><span style=3D"color:#0=
00"><br></span><span style=3D"color:#008">void</span><span style=3D"color:#=
000"> hooray</span><span style=3D"color:#660">(</span><span style=3D"color:=
#000">T t</span><span style=3D"color:#660">)</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#660">{</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 </span><span style=3D"color:#008">return</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Meta</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">f</span><span style=3D"=
color:#660">(</span><span style=3D"color:#000">t</span><span style=3D"color=
:#660">);</span><span style=3D"color:#000"><br></span><span style=3D"color:=
#660">}</span><span style=3D"color:#000"><br><br></span><span style=3D"colo=
r:#800">// ...</span><span style=3D"color:#000"><br>hooray</span><span styl=
e=3D"color:#660">&lt;</span><span style=3D"color:#606">One</span><span styl=
e=3D"color:#660">&gt;(</span><span style=3D"color:#000">a_red_thing</span><=
span style=3D"color:#660">);</span><span style=3D"color:#000"><br>hooray</s=
pan><span style=3D"color:#660">&lt;</span><span style=3D"color:#606">Two</s=
pan><span style=3D"color:#660">&gt;(</span><span style=3D"color:#000">a_blu=
e_thing</span><span style=3D"color:#660">);</span></div></code></div><div><=
br></div></div><div>The difference between the &quot;concept&quot; approach=
 and the &quot;anonymous requires-clause&quot; approach has to do with subs=
umption rules.</div><div>Also, this smells a lot like smuggling a concept (=
e.g. `Red`) through a function declaration (`One::f`), i.e., a sneaky techn=
ical workaround for a missing feature in the language, analogous to how we =
used to have to smuggle variable templates through class templates (e.g. ev=
ery type-trait ever).</div><div><br></div><div>If you&#39;re willing to for=
go subsumption (which I personally am, AFAIK), then you can already achieve=
 the goal of &quot;member concepts&quot; by simply rewriting all your conce=
pts as plain old variable templates. To the extent that this doesn&#39;t wo=
rk, it shows why we might want to add real member concepts and concept alia=
ses. To the extent that this does work, it shows why we don&#39;t technical=
ly need the `concept` keyword at all.</div><div><br></div><div><div style=
=3D"background-color:rgb(250,250,250);border:1px solid rgb(187,187,187);wor=
d-wrap:break-word"><code><div><span style=3D"color:#008">struct</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#606">One</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">templat=
e</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#606">Re=
d</span><span style=3D"color:#000"> T</span><span style=3D"color:#660">&gt;=
</span><span style=3D"color:#000"> </span><span style=3D"color:#008">static=
</span><span style=3D"color:#000"> </span><span style=3D"color:#008">void</=
span><span style=3D"color:#000"> f</span><span style=3D"color:#660">(</span=
><span style=3D"color:#000">T</span><span style=3D"color:#660">);</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008"=
>template</span><span style=3D"color:#660">&lt;</span><span style=3D"color:=
#008">class</span><span style=3D"color:#000"> T</span><span style=3D"color:=
#660">&gt;</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
08">static</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
08">constexpr</span><span style=3D"color:#000"> </span><span style=3D"color=
:#008">bool</span><span style=3D"color:#000"> concept_ </span><span style=
=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D=
"color:#606">Red</span><span style=3D"color:#660">&lt;</span><span style=3D=
"color:#000">T</span><span style=3D"color:#660">&gt;;</span><span style=3D"=
color:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"c=
olor:#000"><br></span><span style=3D"color:#008">struct</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Two</span><span style=3D=
"color:#000"> </span><span style=3D"color:#660">{</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">template</span>=
<span style=3D"color:#660">&lt;</span><span style=3D"color:#606">Blue</span=
><span style=3D"color:#000"> T</span><span style=3D"color:#660">&gt;</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#008">static</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#008">void</span><s=
pan style=3D"color:#000"> f</span><span style=3D"color:#660">(</span><span =
style=3D"color:#000">T</span><span style=3D"color:#660">);</span><span styl=
e=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">templa=
te</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">c=
lass</span><span style=3D"color:#000"> T</span><span style=3D"color:#660">&=
gt;</span><span style=3D"color:#000"> </span><span style=3D"color:#008">sta=
tic</span><span style=3D"color:#000"> </span><span style=3D"color:#008">con=
stexpr</span><span style=3D"color:#000"> </span><span style=3D"color:#008">=
bool</span><span style=3D"color:#000"> concept_ </span><span style=3D"color=
:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#6=
06">Blue</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#=
000">T</span><span style=3D"color:#660">&gt;;</span><span style=3D"color:#0=
00"><br></span><span style=3D"color:#660">};</span><span style=3D"color:#00=
0"><br><br></span><span style=3D"color:#008">template</span><span style=3D"=
color:#660">&lt;</span><span style=3D"color:#008">class</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Meta</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#008">class</span><span style=3D"color:#000"> T</span><span style=3D"c=
olor:#660">&gt;</span><span style=3D"color:#000"> requires </span><span sty=
le=3D"color:#606">Meta</span><span style=3D"color:#660">::</span><span styl=
e=3D"color:#008">template</span><span style=3D"color:#000"> concept_</span>=
<span style=3D"color:#660">&lt;</span><span style=3D"color:#000">T</span><s=
pan style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></span><=
span style=3D"color:#008">void</span><span style=3D"color:#000"> hooray</sp=
an><span style=3D"color:#660">(</span><span style=3D"color:#000">T t</span>=
<span style=3D"color:#660">)</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
</span><span style=3D"color:#008">return</span><span style=3D"color:#000"> =
</span><span style=3D"color:#606">Meta</span><span style=3D"color:#660">::<=
/span><span style=3D"color:#000">f</span><span style=3D"color:#660">(</span=
><span style=3D"color:#000">t</span><span style=3D"color:#660">);</span><sp=
an style=3D"color:#000"><br></span><span style=3D"color:#660">}</span><span=
 style=3D"color:#000"><br><br></span><span style=3D"color:#800">// ...</spa=
n><span style=3D"color:#000"><br>hooray</span><span style=3D"color:#660">&l=
t;</span><span style=3D"color:#606">One</span><span style=3D"color:#660">&g=
t;(</span><span style=3D"color:#000">a_red_thing</span><span style=3D"color=
:#660">);</span><span style=3D"color:#000"><br>hooray</span><span style=3D"=
color:#660">&lt;</span><span style=3D"color:#606">Two</span><span style=3D"=
color:#660">&gt;(</span><span style=3D"color:#000">a_blue_thing</span><span=
 style=3D"color:#660">);</span></div></code></div><div><br></div></div><div=
><a href=3D"https://wandbox.org/permlink/ySWp3QWnqWIxylQN" target=3D"_blank=
" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://www.google.com/u=
rl?q\x3dhttps%3A%2F%2Fwandbox.org%2Fpermlink%2FySWp3QWnqWIxylQN\x26sa\x3dD\=
x26sntz\x3d1\x26usg\x3dAFQjCNElSWfWjtZRVeBk11bq3cQ4wDPhOg&#39;;return true;=
" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2=
Fwandbox.org%2Fpermlink%2FySWp3QWnqWIxylQN\x26sa\x3dD\x26sntz\x3d1\x26usg\x=
3dAFQjCNElSWfWjtZRVeBk11bq3cQ4wDPhOg&#39;;return true;">Here&#39;s the exam=
ple, complete and compilable.</a></div><div><br></div><div>=E2=80=93Arthur<=
/div></div></blockquote><div><br></div><div>Probably one thing that prevent=
 this usage is that `concept_` concept isn&#39;t concept at least when `hoo=
ray` is parsed, you will need use prefix `concept` to allow correct parsing=
 of this code (same as you need use `template` or `typename`).</div><div><b=
r></div><div>Another thing, why not use `some_concept&lt;M, T&gt;`?</div><d=
iv><br></div><div>Overall I think this was <span id=3D"result_box" class=3D=
"short_text" lang=3D"en"><span class=3D"">deliberately </span></span>done t=
o simplify whole design and avion any unexpected iterations, It would be ba=
d if concepts skyrocket to level of template metaprograming from beginning,=
 AFAIK right now you can&#39;t do any arbitrary ordering of concepts that d=
epends on metaprograming and this is good thing.<br></div><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/0b82cc47-9dd1-41f1-80b4-3e1469aaa9a9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/0b82cc47-9dd1-41f1-80b4-3e1469aaa9a9=
%40isocpp.org</a>.<br />

------=_Part_639_388732386.1533885897631--

------=_Part_638_172201033.1533885897630--

.
