220 31472 <a0f4db51-ab03-4173-979e-52613b9577a2@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Erich Keane <erich.keane@verizon.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: overloading by constexpr (round 2?)
Date: Mon, 6 Mar 2017 15:16:53 -0800 (PST)
Lines: 231
Approved: news@gmane.org
Message-ID: <a0f4db51-ab03-4173-979e-52613b9577a2@isocpp.org>
References: <CAFdMc-2q3KpV+m5cfWr6b02XmHVUdxsNCNAVFG+mzCv0QY7ZRg@mail.gmail.com>
 <CAOfiQqm4VgaS8OSeopB88dE68CNYRubwZa5H0f2F0rn6FsOWXw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_659_1802273394.1488842213842"
X-Trace: blaine.gmane.org 1488842222 23692 195.159.176.226 (6 Mar 2017 23:17:02 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 6 Mar 2017 23:17:02 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCWZXNPJO4IONW7XYUCRUBHD3EIOW@isocpp.org Tue Mar 07 00:16:53 2017
Return-path: <std-proposals+bncBCWZXNPJO4IONW7XYUCRUBHD3EIOW@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f197.google.com ([209.85.161.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCWZXNPJO4IONW7XYUCRUBHD3EIOW@isocpp.org>)
	id 1cl1s1-0004s3-OI
	for gclcip-std-proposals@m.gmane.org; Tue, 07 Mar 2017 00:16:50 +0100
Original-Received: by mail-yw0-f197.google.com with SMTP id k13sf50521163ywk.2
        for <gclcip-std-proposals@m.gmane.org>; Mon, 06 Mar 2017 15:16:55 -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
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=refI9LgXwOP9YWY3qJRpC1/GIdg66+fHrbhw2xGiofo=;
        b=ryVagWJQm6vUN7Vi/q3wCD3n7KaVPf+NyTAJumDhwJVt6Z8XgCKJXcmPtgWMUhRTaL
         9QIrzqzFbyBw3914GPh9i5692sDcuEJd6gfAHcAusaFk0LONyQ3Loi0AV4EJFEcEx3rA
         Grr59QOhbNEwda3KD/0SjbGFuNqeR2FyCPfWOwTLVGJUN90bTrkBKu5HoYZ5x+UJHcBL
         JXhPBOwzmNI8uOtvC56nBaK6ak84ahuCKc9qNCzZEWNgKjoGP50/WJLm/zv/R35Dk1YS
         tnyL1l3HlQbbLdFFESEP6tXe0QQNYwadLkRVRkIMc6btM/lPuRqLL9PUP0ZpAAwcMTJr
         EDOw==
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=refI9LgXwOP9YWY3qJRpC1/GIdg66+fHrbhw2xGiofo=;
        b=Oaclg/HD+YKrUtsW3pZ/HaRXNHwc+cL1rMwqPW4RCqFvuyIM3f1kK3cWqHtVLTyoON
         5E70QpZhAuGNEXjUUxdYF/6kYVd1j+Q2oiPg/r9CfR08IhDIKSxRIbasG80QPyDKvUW1
         kqrw1fiY6hZucHFKRCyVxZMUxcjmkU6VJayYJBQwrWv9scNuHrShZuKL0UDrqfWhchyU
         xlz3fnHisIv06eZBRryv0Wn0REZzlC7lwiPhMonUNTRarfk1QbU891tTZRgDnOaMNGsk
         /eISSqdbzdHv1k148PMTGiLdT0alY940j8YGrfEosJMyPbrhODshw35GLwWJQADp0hPa
         0mDA==
X-Gm-Message-State: AMke39nIJcZCYomCe1Xph/YI6ZWNMmr1P5iSjRiHq8zC6KjV/dJymuc5NCtoDcOeJ5jJBA==
X-Received: by 10.13.238.134 with SMTP id x128mr8203430ywe.59.1488842215328;
        Mon, 06 Mar 2017 15:16:55 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.62.180 with SMTP id b49ls18206441otc.36.gmail; Mon, 06 Mar
 2017 15:16:54 -0800 (PST)
X-Received: by 10.157.82.72 with SMTP id q8mr1345161otg.4.1488842214425;
        Mon, 06 Mar 2017 15:16:54 -0800 (PST)
In-Reply-To: <CAOfiQqm4VgaS8OSeopB88dE68CNYRubwZa5H0f2F0rn6FsOWXw@mail.gmail.com>
X-Original-Sender: erich.keane@verizon.net
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:31472
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31472>

------=_Part_659_1802273394.1488842213842
Content-Type: multipart/alternative; 
	boundary="----=_Part_660_2000997385.1488842213843"

------=_Part_660_2000997385.1488842213843
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

We also approved "do constexpr" functions which Daveed also presented=20
(constexpr ONLY functions). =20

    do constexpr void f(){...} // Function can only be called at=20
compiletime, error otherwise.

The idea of overloading based on constexpr'ness of a function came up in=20
the break, and a number of people mentioned there were some significant=20
issues with it, and it seemed that 'if (constexpr())' (though with a=20
different, pseudo-library function spelling) had significantly more=20
consensus.

On Monday, March 6, 2017 at 1:30:33 PM UTC-8, Richard Smith wrote:
>
> You might want to get in touch with the author of=20
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0595r0.html=20
> (which was discussed in Evolution last week and seems to have had a=20
> favourable reception).
>
> On 6 March 2017 at 10:15, dgutson . <daniel...@gmail.com <javascript:>>=
=20
> wrote:
>
>> I'm proposing the ability to provide two versions of a function,=20
>> overloaded by the constexpr specifier: one constexpr version and another=
=20
>> non-constexpr version, and let the compiler use the appropriate one=20
>> according to the context.
>>
>> A slightly similar subject has been discussed before (
>> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/oxijwTY-ft4=
/discussion=20
>> ).
>> Additionally, people seems to be interested in detecting constexpr-ness=
=20
>> (e.g.=20
>> http://stackoverflow.com/questions/15232758/detecting-constexpr-with-sfi=
nae)=20
>> to achieve the same "manually".
>>
>> I'm talking about to make this simpler:
>>
>> constexpr int f()
>> {
>>     return 1;
>> }
>>
>> int f()
>> {
>>     return 2;
>> }
>>
>> constexpr auto a =3D f();    // a =3D 1
>> auto fun =3D std::function<int(void)>(f);
>> int b =3D fun();   // b =3D 2
>>
>> If there is some interest, I can star working in a gcc fork as a=20
>> prototype.
>>
>> BRgds,
>>
>>     Daniel.
>>
>>
>> --=20
>> Who=E2=80=99s got the sweetest disposition?
>> One guess, that=E2=80=99s who?
>> Who=E2=80=99d never, ever start an argument?
>> Who never shows a bit of temperament?
>> Who's never wrong but always right?
>> Who'd never dream of starting a fight?
>> Who get stuck with all the bad luck?=20
>>
>> --=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit=20
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-2q3K=
pV%2Bm5cfWr6b02XmHVUdxsNCNAVFG%2BmzCv0QY7ZRg%40mail.gmail.com=20
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-2q3=
KpV%2Bm5cfWr6b02XmHVUdxsNCNAVFG%2BmzCv0QY7ZRg%40mail.gmail.com?utm_medium=
=3Demail&utm_source=3Dfooter>
>> .
>>
>
>

--=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/a0f4db51-ab03-4173-979e-52613b9577a2%40isocpp.or=
g.

------=_Part_660_2000997385.1488842213843
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">We also approved &quot;do constexpr&quot; functions which =
Daveed also presented (constexpr ONLY functions).=C2=A0 <br><br>=C2=A0=C2=
=A0=C2=A0 do constexpr void f(){...} // Function can only be called at comp=
iletime, error otherwise.<br><br>The idea of overloading based on constexpr=
&#39;ness of a function came up in the break, and a number of people mentio=
ned there were some significant issues with it, and it seemed that &#39;if =
(constexpr())&#39; (though with a different, pseudo-library function spelli=
ng) had significantly more consensus.<br><br>On Monday, March 6, 2017 at 1:=
30:33 PM UTC-8, Richard Smith 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"><div><div class=3D"gmail_quote">You might want to ge=
t in touch with the author of <a href=3D"http://www.open-std.org/jtc1/sc22/=
wg21/docs/papers/2017/p0595r0.html" target=3D"_blank" rel=3D"nofollow" onmo=
usedown=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww=
..open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0595r0.html\x2=
6sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGBy7-98sVjjKijxZd31_aHZmR0AQ&#39;;ret=
urn true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%=
3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp059=
5r0.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGBy7-98sVjjKijxZd31_aHZmR0=
AQ&#39;;return true;">http://www.open-std.org/jtc1/<wbr>sc22/wg21/docs/pape=
rs/2017/<wbr>p0595r0.html</a> (which was discussed in Evolution last week a=
nd seems to have had a favourable reception).</div><div class=3D"gmail_quot=
e"><br></div><div class=3D"gmail_quote">On 6 March 2017 at 10:15, dgutson .=
 <span dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfusc=
ated-mailto=3D"eVVUes9PCwAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#=
39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#=
39;;return true;">daniel...@gmail.com</a>&gt;</span> wrote:<br><blockquote =
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px sol=
id rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div><div>I&#39;m pr=
oposing the ability to provide two versions of a function,=20
overloaded by the constexpr specifier: one constexpr version and another
 non-constexpr version, and let the compiler use the appropriate one=20
according to the context.<br></div><div><br></div>A slightly similar subjec=
t has been discussed before (<a href=3D"https://groups.google.com/a/isocpp.=
org/d/topic/std-proposals/oxijwTY-ft4/discussion" target=3D"_blank" rel=3D"=
nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/a/isocp=
p.org/d/topic/std-proposals/oxijwTY-ft4/discussion&#39;;return true;" oncli=
ck=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/topic/std-p=
roposals/oxijwTY-ft4/discussion&#39;;return true;">https://groups.google.co=
m/a/<wbr>isocpp.org/d/topic/std-<wbr>proposals/oxijwTY-ft4/<wbr>discussion<=
/a> ).<br></div><div>Additionally, people seems to be interested in detecti=
ng constexpr-ness (e.g. <a href=3D"http://stackoverflow.com/questions/15232=
758/detecting-constexpr-with-sfinae" target=3D"_blank" rel=3D"nofollow" onm=
ousedown=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fst=
ackoverflow.com%2Fquestions%2F15232758%2Fdetecting-constexpr-with-sfinae\x2=
6sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGPo3AX-xJYFXlFCYzAupI6x3DTKQ&#39;;ret=
urn true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%=
3A%2F%2Fstackoverflow.com%2Fquestions%2F15232758%2Fdetecting-constexpr-with=
-sfinae\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGPo3AX-xJYFXlFCYzAupI6x3DTK=
Q&#39;;return true;">http://stackoverflow.com/<wbr>questions/15232758/detec=
ting-<wbr>constexpr-with-sfinae</a>) to achieve the same &quot;manually&quo=
t;.<br><br></div><div>I&#39;m talking about to make this simpler:<br></div>=
<br><div>constexpr int f()<br>{<br></div><div>=C2=A0=C2=A0=C2=A0 return 1;<=
br></div><div>}<br><br></div><div>int f()<br>{<br></div><div>=C2=A0=C2=A0=
=C2=A0 return 2;<br></div><div>}<br><br></div><div>constexpr auto a =3D f()=
;=C2=A0=C2=A0=C2=A0 // a =3D 1<br></div><div>auto fun =3D std::function&lt;=
int(void)&gt;(f);<br></div><div>int b =3D fun();=C2=A0=C2=A0 // b =3D 2<br>=
<br></div><div><div>If there is some interest, I can star working in a gcc =
fork as a prototype.<br><br></div><div>BRgds,<br><br></div><div>=C2=A0=C2=
=A0=C2=A0 Daniel.<span><font color=3D"#888888"><br><br><br></font></span></=
div><span><font color=3D"#888888"><div>-- <br><div>Who=E2=80=99s got the sw=
eetest disposition?<br>One guess, that=E2=80=99s who?<br>Who=E2=80=99d neve=
r, ever start an argument?<br>Who never shows a bit of temperament?<br>Who&=
#39;s never wrong but always right?<br>Who&#39;d never dream of starting a =
fight?<br>Who get stuck with all the bad luck? </div>
</div></font></span></div><span><font color=3D"#888888"><br></font></span><=
/div><span><font color=3D"#888888">

<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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
eVVUes9PCwAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"eVVUes9PCwAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@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/CAFdMc-2q3KpV%2Bm5cfWr6b02XmHVUdxsNCN=
AVFG%2BmzCv0QY7ZRg%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfoo=
ter" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-2q3KpV%2Bm=
5cfWr6b02XmHVUdxsNCNAVFG%2BmzCv0QY7ZRg%40mail.gmail.com?utm_medium\x3demail=
\x26utm_source\x3dfooter&#39;;return true;" onclick=3D"this.href=3D&#39;htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-2q3KpV%2Bm=
5cfWr6b02XmHVUdxsNCNAVFG%2BmzCv0QY7ZRg%40mail.gmail.com?utm_medium\x3demail=
\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/a/<wb=
r>isocpp.org/d/msgid/std-<wbr>proposals/CAFdMc-2q3KpV%<wbr>2Bm5cfWr6b02XmHV=
UdxsNCNAVFG%<wbr>2BmzCv0QY7ZRg%40mail.gmail.com</a><wbr>.<br>
</font></span></blockquote></div><br></div></div>
</blockquote></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/a0f4db51-ab03-4173-979e-52613b9577a2%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a0f4db51-ab03-4173-979e-52613b9577a2=
%40isocpp.org</a>.<br />

------=_Part_660_2000997385.1488842213843--

------=_Part_659_1802273394.1488842213842--

.
