220 37085 <805d3933-0cf9-465f-906c-849ab25c7a63@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: bastienpenava@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: specify concept implementation
Date: Mon, 26 Feb 2018 11:48:16 -0800 (PST)
Lines: 127
Approved: news@gmane.org
Message-ID: <805d3933-0cf9-465f-906c-849ab25c7a63@isocpp.org>
References: <93e7e509-edf0-4df6-9b2f-555bba92a04a@isocpp.org>
 <a1345907-f673-43f5-afb8-3ad064a0a6d6@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_15043_70308916.1519674496113"
X-Trace: blaine.gmane.org 1519674377 18385 195.159.176.226 (26 Feb 2018 19:46:17 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 26 Feb 2018 19:46:17 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCG3XHNI6IDRBAOJ2HKAKGQE7DK3YCI@isocpp.org Mon Feb 26 20:46:13 2018
Return-path: <std-proposals+bncBCG3XHNI6IDRBAOJ2HKAKGQE7DK3YCI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f199.google.com ([209.85.217.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCG3XHNI6IDRBAOJ2HKAKGQE7DK3YCI@isocpp.org>)
	id 1eqOix-0004FB-Qq
	for gclcip-std-proposals@m.gmane.org; Mon, 26 Feb 2018 20:46:12 +0100
Original-Received: by mail-ua0-f199.google.com with SMTP id y43sf10490999uac.16
        for <gclcip-std-proposals@m.gmane.org>; Mon, 26 Feb 2018 11:48: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=9gBcHcIfacRqBje1brujpJbGCUuexRcqh/bvYLU9S4Y=;
        b=dggx7bK0cMIEcRhjNDeIfU3aXkgwDYI+p1JZSLyPuIQ+/UiNvFkTYLwq4h0H+n34a3
         Kkr+ryjtl3rz61sAy0qI+84r2lzgTyWgJlJfIzne3JcGcMGuMWH2xKGH+4XDUnGIqD7R
         02Cu6ZrKf6/KMIo2IADP0j1JYTk27yWhwdSNkP4ycVP3ETq+Tg/C4FR5CcQEySgv/RJI
         Vd/T4bhInzH+cA0KQi1y/Lqcq3smV/vTw9PoyWT/yxOSivT1DM+KxEKpIOj2TByVyLKi
         z/U0HK7SYjFvmk1fnMP60AnRtzyXGqscL9jCSu2QVRM3w+hBNwh/FGzMwM7TLD1YcQWk
         tjKg==
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=9gBcHcIfacRqBje1brujpJbGCUuexRcqh/bvYLU9S4Y=;
        b=odD071OG51lgNHM/WPqkfFukgQZ6JS+24dVzFVTDCQpCtnt0JnhuFI5QxoInxWMV+e
         psQF/04Egyr/7tXNab7vnU+psytYkGFJLHopo8OGf+Y96EJpWZH1D9F/eEbcBuPxDyN1
         Y7ku/JwPDMPXWS0SnqQwf4etLH9IFzqB3eu/ys9jsLnqZKEz/JCrVzlwcsM5hMUoSVLy
         ddHg97r6k58DLJiMpV0aSJaWWXj6MUJhmBJPOeUk54HDJg4iyF4K1dXTUwKHLKJ6rZlX
         uhMJcoXKu0n+GoSxF4Yyj2YrE88USSfjKEaC33HvV8yx60DNh6qxNxmXRy6az76n7SK0
         NZPw==
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=9gBcHcIfacRqBje1brujpJbGCUuexRcqh/bvYLU9S4Y=;
        b=Dr3sQkusbFGtZytV2tciWKYm9IMhDK61w44SQsf68qI6O7xewlYCCI7sV+zQgTVyzc
         f+rfkhevBIaTpFmj0ViCTyZQskIhDtKszP9HzxxqRCsavjgcI/I+lRbrSCwjUzjP0wmR
         J0WHR4kwOWSuy7wHhSovAyTQo26gLhmQ9vCqzB/5ODGUZFTiTNt8SotgEsNbeYhFgr9z
         6KAzTtR+rcFy/Ml5xTTc/rqgIdW9Bnkn5jRsYA+5mwICV0vBq69JtzpwLRkOtMTvOn+t
         j7rAFRWfigMldOmwBQDrdfxbQBz3/wa2JRZ4vpTJ/iEXVMmnF97YPDTj9hLTbPWc2hPf
         VHKA==
X-Gm-Message-State: APf1xPAnjRNQgZDq3PWMgATsKcvka/rNOGzrz5dH6m3zq4ceSaHOnKm9
	Y2BNhh03jK7dVXdxipxyw7CV2w==
X-Google-Smtp-Source: AG47ELsH39q9bBUElgfvrr0Bvask0bTbLJrMnHc8qxgjktVWKI+VAP3YmB26BylZs8ymMH2/HehEIQ==
X-Received: by 10.31.107.20 with SMTP id g20mr5955891vkc.0.1519674498164;
        Mon, 26 Feb 2018 11:48:18 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.31.185.202 with SMTP id j193ls2950340vkf.18.gmail; Mon, 26 Feb
 2018 11:48:16 -0800 (PST)
X-Received: by 10.31.162.130 with SMTP id l124mr120346vke.0.1519674496680;
        Mon, 26 Feb 2018 11:48:16 -0800 (PST)
In-Reply-To: <a1345907-f673-43f5-afb8-3ad064a0a6d6@isocpp.org>
X-Original-Sender: BastienPenava@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:37085
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37085>

------=_Part_15043_70308916.1519674496113
Content-Type: multipart/alternative; 
	boundary="----=_Part_15044_1523856259.1519674496113"

------=_Part_15044_1523856259.1519674496113
Content-Type: text/plain; charset="UTF-8"

On Monday, February 26, 2018 at 5:37:43 PM UTC+1, Nicol Bolas wrote:
>
> And what about if you want to implement a type that follows a concept, but 
> you're using non-member functions to implement certain aspects of that 
> concept? This wouldn't work, would it?
>
> It's better to just use the obvious tool: `static_assert`. We don't need 
> to add a whole language feature for trivial convenience like this.
>
For the non-member function yes it would work as long as you 
friend-prototype/define said function.

As for static_assert, no it's not.
static_assert on an explicit concept call only triggers a "something went 
wrong" level of informations: https://godbolt.org/g/5Hb7zP

The focus point though wasn't the static_assert part at all.
It was to explicitly state that a class is meant as an implementation of 
some concepts for readability purposes
and to have some, possibly, interesting debugging side-effects coming from 
that. 

I agree though that a whole language feature would be overkill.
What about an attribute?

template<class T>
concept ValueType = requires() { T::value; }

[[concept C]] //can, or not, check if A satisfies C and issue either a 
warning or error.
struct A
{
};

-- 
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/805d3933-0cf9-465f-906c-849ab25c7a63%40isocpp.org.

------=_Part_15044_1523856259.1519674496113
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Monday, February 26, 2018 at 5:37:43 PM UTC+1, Nicol Bo=
las wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><di=
v>And what about if you want to implement a type that follows a concept, bu=
t you&#39;re using non-member functions to implement certain aspects of tha=
t concept? This wouldn&#39;t work, would it?<br><br>It&#39;s better to just=
 use the obvious tool: `static_assert`. We don&#39;t need to add a whole la=
nguage feature for trivial convenience like this.<br></div></div></blockquo=
te><div>For the non-member function yes it would work as long as you friend=
-prototype/define said function.</div><div><br></div><div>As for static_ass=
ert, no it&#39;s not.<br></div><div>static_assert on an explicit concept ca=
ll only triggers a &quot;something went wrong&quot; level of informations:=
=C2=A0<a href=3D"https://godbolt.org/g/5Hb7zP">https://godbolt.org/g/5Hb7zP=
</a></div><div><br></div><div>The focus point though wasn&#39;t the static_=
assert part at all.</div><div>It was to explicitly state that a class is me=
ant as an implementation of some concepts for readability purposes</div><di=
v>and to have some, possibly, interesting debugging side-effects coming fro=
m that.=C2=A0<br></div><div><br></div><div>I agree though that a whole lang=
uage feature would be overkill.</div><div>What about an attribute?</div><di=
v><br></div><div><div class=3D"prettyprint" style=3D"background-color: rgb(=
250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bord=
er-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div cla=
ss=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">template</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">cla=
ss</span><span style=3D"color: #000;" class=3D"styled-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-prettify"><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">concept</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
606;" class=3D"styled-by-prettify">ValueType</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> requires</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">()</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">value</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">[[</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">concept</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> C</span><span style=3D"color: #660;" class=3D"styled-by-prettify">]=
]</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #800;" class=3D"styled-by-prettify">//can, or not, che=
ck if A satisfies C and issue either a warning or error.</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> A<br></span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">};</span></div></code></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/805d3933-0cf9-465f-906c-849ab25c7a63%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/805d3933-0cf9-465f-906c-849ab25c7a63=
%40isocpp.org</a>.<br />

------=_Part_15044_1523856259.1519674496113--

------=_Part_15043_70308916.1519674496113--

.
