220 39177 <abe8f0c5-5a08-4301-b26a-871f4abacdab@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Concepts requires clause should allow types that
 constexpr implicitly convert to bool?
Date: Sun, 15 Jul 2018 15:48:10 -0700 (PDT)
Lines: 96
Approved: news@gmane.org
Message-ID: <abe8f0c5-5a08-4301-b26a-871f4abacdab@isocpp.org>
References: <79029827-71df-4af1-ae50-607e96c5e322@isocpp.org>
 <CALmDwq07Aispgz_-pTGix=1vGpF1QupHUFgzw9D0bggGQL5_oQ@mail.gmail.com>
 <0f77fb8d-5058-47e9-b1ec-519958786893@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_48556_996312867.1531694890424"
X-Trace: blaine.gmane.org 1531694765 31762 195.159.176.226 (15 Jul 2018 22:46:05 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 15 Jul 2018 22:46:05 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDLZJYWNDQIKXHVP3ICRUBC7HE3VG@isocpp.org Mon Jul 16 00:46:01 2018
Return-path: <std-proposals+bncBDLZJYWNDQIKXHVP3ICRUBC7HE3VG@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb0-f197.google.com ([209.85.213.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDLZJYWNDQIKXHVP3ICRUBC7HE3VG@isocpp.org>)
	id 1fepmD-0008AV-B9
	for gclcip-std-proposals@m.gmane.org; Mon, 16 Jul 2018 00:46:01 +0200
Original-Received: by mail-yb0-f197.google.com with SMTP id q12-v6sf32794965ybp.11
        for <gclcip-std-proposals@m.gmane.org>; Sun, 15 Jul 2018 15:48:12 -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=+RXiWz9bV/KCa897XKDNvZ18jsRH98XMyJ1GU7MyQGw=;
        b=KttH/56tqGYH+zCQTHqDxYfwfCsjDJrndS/qwCAsqLYTivSBllorPiIqW761jYALoL
         T318lJi2a0sUATxMKsp444JMlkbZSvnsr3dFV5LD/emM/VI7kles9mq7XyRLPZqZrSLD
         vn6tUVGXAvtF99Y8qP8ezaLD3imOsNA21pYfhIR4WU3kuX5HKi+uIckF9gdKBkPDG9Jg
         kn+qD/JuE+k6ibkj7K4xaQdqd9GM8uJ6WEkIjBIi3qbEHp7EjXvedBJpvTyydPLBRjWH
         SxZ045vt/bUm5Gvroi4rEx29TSsxU+uN7E7tLaBBj0CZi7F2TmPJPw/FCZLGZ0ZwjnDL
         9pBQ==
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=+RXiWz9bV/KCa897XKDNvZ18jsRH98XMyJ1GU7MyQGw=;
        b=F/9HaO/QVxyp7L/wbZiJX97BfEbNyF9+jDeB1tskuqsFI2uwrMVGn9XFHD2WnDIz4X
         dN6DNN3mg8wO0Yva1Du/OFCgyCSYZ+pE28c377kuEV+XYIrOQHO9opE5rY40xZbzs7CP
         Zqp94CI5HWGHjV90Q/Zp2FfPMsCTtWJYMwbDrcWaSIity7daUlhkFoIc4p4/Gat9znV2
         PAEgnYeBiu9KikLkr7WJBDJZowHJdOEiOxS/RheFKDb/oya4yfN1haxlbrEz8vrsgwVe
         M0zD9LsnRtAMuXmPS6c/dwj5GjLioeJBSe/xnYpVTT4lDGoJMk0wa6H3+UBPU/oXZNNC
         JDQw==
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=+RXiWz9bV/KCa897XKDNvZ18jsRH98XMyJ1GU7MyQGw=;
        b=f4rEo9ni13zKG8KDLw/4Mcxk2lr+YffHkPvsxhrbaoDBit8Zp3KmccoLXn8Mj3WK2k
         gLMjrDRPTn6RY851O0Q3+aBnJV+n+xSj5AMsURS9ztbQE0DXVLsav6SssnGzVBrgpXIC
         4EsTSD+n+aQHxYNpGudwTKENrW2C6+dbkIO7vAIDUXx04Jwwsr208O30Ak1/dqniVQlz
         xkq9lBj82+KX9lSOZ6X2ukit+E0qEjpuksYg59COKXYvI/yapfjX/hKdiwLX7n41LSax
         CijUOPxvmCc1u7ws85qHEPuJm7/ZmBnhLKKZ0bxNZ6ZMS1m6hcTvi+CB3ihcVKHPatDS
         5L+w==
X-Gm-Message-State: AOUpUlE/acpwq9LV41FUhB/xqWl8Q/yGceUnb6DPD8kP0oFyYRnTwaCm
	zbgjCdqXMytwMTIQ8NcQ1Zs8Vw==
X-Google-Smtp-Source: AAOMgpdsgGQCboy4Cx6dzoBWqAS151GAwh27wFnA1F66sqRwwWroRotHxfuu/QL1LHUS0BuCvWjIdg==
X-Received: by 2002:a81:1786:: with SMTP id 128-v6mr4927324ywx.176.1531694891979;
        Sun, 15 Jul 2018 15:48:11 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a25:4181:: with SMTP id o123-v6ls8360528yba.21.gmail; Sun,
 15 Jul 2018 15:48:11 -0700 (PDT)
X-Received: by 2002:a25:8203:: with SMTP id q3-v6mr1803048ybk.1.1531694890824;
        Sun, 15 Jul 2018 15:48:10 -0700 (PDT)
In-Reply-To: <0f77fb8d-5058-47e9-b1ec-519958786893@isocpp.org>
X-Original-Sender: arthur.j.odwyer@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:39177
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/39177>

------=_Part_48556_996312867.1531694890424
Content-Type: multipart/alternative; 
	boundary="----=_Part_48557_902166159.1531694890425"

------=_Part_48557_902166159.1531694890425
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sunday, July 15, 2018 at 3:44:52 PM UTC-7, Arthur O'Dwyer wrote:
>
> Another easy workaround would be to change the word `auto` to `bool`.
> I would expect requires(x) to follow exactly the same rules as=20
> noexcept(x). If it doesn't, that's a bug in my book.
>

And IIUC, your original code is equivalent to

template<auto v>
constexpr bool is_even =3D (v % 2 =3D=3D 0);

template<auto v> requires is_even<v>
int some_function()
{
  return (v * 3);
}

int main ()
{
  std::cout << some_function<4>() << '\n';
}

is that right? The integral_constant stuff just seems unnecessarily=20
confusing to me.

=E2=80=93Arthur

--=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/abe8f0c5-5a08-4301-b26a-871f4abacdab%40isocpp.or=
g.

------=_Part_48557_902166159.1531694890425
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Sunday, July 15, 2018 at 3:44:52 PM UTC-7, Arthur O&#39=
;Dwyer wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
Another easy workaround would be to change the word `auto` to `bool`.<div>I=
 would expect requires(x) to follow exactly the same rules as noexcept(x). =
If it doesn&#39;t, that&#39;s a bug in my book.</div></div></blockquote><di=
v><br></div><div>And IIUC, your original code is equivalent to</div><div><b=
r></div><div><div><font face=3D"courier new, monospace">template&lt;auto v&=
gt;</font></div><div><font face=3D"courier new, monospace">constexpr bool i=
s_even =3D (v % 2 =3D=3D 0);</font></div><div><br></div><div><font face=3D"=
courier new, monospace">template&lt;auto v&gt;</font><span style=3D"font-fa=
mily: &quot;courier new&quot;, monospace;">=C2=A0requires is_even&lt;v&gt;<=
/span></div><div><span style=3D"font-family: &quot;courier new&quot;, monos=
pace;">int some_function()</span></div><div><span style=3D"font-family: &qu=
ot;courier new&quot;, monospace;">{</span></div><div><font face=3D"courier =
new, monospace">=C2=A0 return (v * 3);</font></div><div><font face=3D"couri=
er new, monospace">}</font></div><div><font face=3D"courier new, monospace"=
><br></font></div><div><font face=3D"courier new, monospace">int main ()</f=
ont></div><div><font face=3D"courier new, monospace">{</font></div><div><fo=
nt face=3D"courier new, monospace">=C2=A0 std::cout &lt;&lt; some_function&=
lt;4&gt;() &lt;&lt; &#39;\n&#39;;</font></div><div><font face=3D"courier ne=
w, monospace">}</font></div></div><div><font face=3D"courier new, monospace=
"><br></font></div><div>is that right? The integral_constant stuff just see=
ms unnecessarily confusing to me.</div><div><br></div><div>=E2=80=93Arthur<=
/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/abe8f0c5-5a08-4301-b26a-871f4abacdab%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/abe8f0c5-5a08-4301-b26a-871f4abacdab=
%40isocpp.org</a>.<br />

------=_Part_48557_902166159.1531694890425--

------=_Part_48556_996312867.1531694890424--

.
