220 31468 <CAOfiQqm4VgaS8OSeopB88dE68CNYRubwZa5H0f2F0rn6FsOWXw@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Richard Smith <richard@metafoo.co.uk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: overloading by constexpr (round 2?)
Date: Mon, 6 Mar 2017 13:30:10 -0800
Lines: 162
Approved: news@gmane.org
Message-ID: <CAOfiQqm4VgaS8OSeopB88dE68CNYRubwZa5H0f2F0rn6FsOWXw@mail.gmail.com>
References: <CAFdMc-2q3KpV+m5cfWr6b02XmHVUdxsNCNAVFG+mzCv0QY7ZRg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11471460d53e2e054a169a4c
X-Trace: blaine.gmane.org 1488835834 990 195.159.176.226 (6 Mar 2017 21:30:34 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 6 Mar 2017 21:30:34 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDVNBJG4YAIBB55J67CQKGQE225U7EY@isocpp.org Mon Mar 06 22:30:29 2017
Return-path: <std-proposals+bncBDVNBJG4YAIBB55J67CQKGQE225U7EY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f71.google.com ([209.85.215.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDVNBJG4YAIBB55J67CQKGQE225U7EY@isocpp.org>)
	id 1cl0D4-0007wh-D3
	for gclcip-std-proposals@m.gmane.org; Mon, 06 Mar 2017 22:30:26 +0100
Original-Received: by mail-lf0-f71.google.com with SMTP id v2sf86134980lfi.2
        for <gclcip-std-proposals@m.gmane.org>; Mon, 06 Mar 2017 13:30:33 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=OKUGV8d2M2qd3+5WB6+q6ZYGDAZWPGcbnOMg8y5l9UM=;
        b=CdlgVuBsWRt71W82B1B/gQTgKW0WRg46qVWI1cW6iGRltszIGs9XeaziZ6foSyXpLR
         w2tk53jXT93s20kdEIEZsy+Vytql9m2uK2H/nz/T2RGuFTMAgfr2ZUS8Ag+iygeGe6iL
         I14oS+mT9dd6aDBsufBMFYkVCIh0YfwJwsGSDqUoRXSXU2JIY6H22rEBkbEYPHXVCuI8
         WBen23rErzR/mRgrbD5Tk6zr/mSBfhQWUTlBIz/QWDGQw/HZbQY7T2VDim0tdn0MlqvC
         HSall4PQqkCdG+0Dm9DQGuampWL0piDgpEFNZYAG0J9HofHGa6WSvA34yV9l/5r8ZebA
         aGxQ==
X-Gm-Message-State: AMke39ngrht9iP2PU1udV2CH8XxILjHHyqDpWDwh28rr6Sh8zwgQBDsKUjkbaIJ1AEO8Kg==
X-Received: by 10.46.5.136 with SMTP id 130mr2662684ljf.6.1488835832840;
        Mon, 06 Mar 2017 13:30:32 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.207.206 with SMTP id f197ls521408wmg.22.gmail; Mon, 06 Mar
 2017 13:30:31 -0800 (PST)
X-Received: by 10.28.134.70 with SMTP id i67mr244061wmd.124.1488835831390;
        Mon, 06 Mar 2017 13:30:31 -0800 (PST)
Original-Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com. [2a00:1450:400c:c09::22f])
        by mx.google.com with ESMTPS id g80si27997835wrd.149.2017.03.06.13.30.31
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 06 Mar 2017 13:30:31 -0800 (PST)
Received-SPF: pass (google.com: domain of metafoo@gmail.com designates 2a00:1450:400c:c09::22f as permitted sender) client-ip=2a00:1450:400c:c09::22f;
Original-Received: by mail-wm0-x22f.google.com with SMTP id n11so75939505wma.0
        for <std-proposals@isocpp.org>; Mon, 06 Mar 2017 13:30:31 -0800 (PST)
X-Received: by 10.28.238.140 with SMTP id j12mr14805256wmi.35.1488835830952;
 Mon, 06 Mar 2017 13:30:30 -0800 (PST)
Original-Sender: metafoo@gmail.com
Original-Received: by 10.80.148.82 with HTTP; Mon, 6 Mar 2017 13:30:10 -0800 (PST)
In-Reply-To: <CAFdMc-2q3KpV+m5cfWr6b02XmHVUdxsNCNAVFG+mzCv0QY7ZRg@mail.gmail.com>
X-Original-Sender: richard@metafoo.co.uk
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of metafoo@gmail.com
 designates 2a00:1450:400c:c09::22f as permitted sender) smtp.mailfrom=metafoo@gmail.com
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:31468
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31468>

--001a11471460d53e2e054a169a4c
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

You might want to get in touch with the author of
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0595r0.html (which
was discussed in Evolution last week and seems to have had a favourable
reception).

On 6 March 2017 at 10:15, dgutson . <danielgutson@gmail.com> wrote:

> I'm proposing the ability to provide two versions of a function,
> overloaded by the constexpr specifier: one constexpr version and another
> non-constexpr version, and let the compiler use the appropriate one
> 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 ).
> Additionally, people seems to be interested in detecting constexpr-ness
> (e.g. http://stackoverflow.com/questions/15232758/detecting-
> constexpr-with-sfinae) 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 prototyp=
e.
>
> BRgds,
>
>     Daniel.
>
>
> --
> 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?
>
> --
> 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/CAFdMc-2q3KpV%
> 2Bm5cfWr6b02XmHVUdxsNCNAVFG%2BmzCv0QY7ZRg%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-2q3K=
pV%2Bm5cfWr6b02XmHVUdxsNCNAVFG%2BmzCv0QY7ZRg%40mail.gmail.com?utm_medium=3D=
email&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/CAOfiQqm4VgaS8OSeopB88dE68CNYRubwZa5H0f2F0rn6FsO=
WXw%40mail.gmail.com.

--001a11471460d53e2e054a169a4c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">You =
might want to get in touch with the author of <a href=3D"http://www.open-st=
d.org/jtc1/sc22/wg21/docs/papers/2017/p0595r0.html">http://www.open-std.org=
/jtc1/sc22/wg21/docs/papers/2017/p0595r0.html</a> (which was discussed in E=
volution last week and seems to have had a favourable reception).</div><div=
 class=3D"gmail_quote"><br></div><div class=3D"gmail_quote">On 6 March 2017=
 at 10:15, dgutson . <span dir=3D"ltr">&lt;<a href=3D"mailto:danielgutson@g=
mail.com" target=3D"_blank">danielgutson@gmail.com</a>&gt;</span> wrote:<br=
><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border=
-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div><d=
iv>I&#39;m proposing 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">https:/=
/groups.google.com/a/<wbr>isocpp.org/d/topic/std-<wbr>proposals/oxijwTY-ft4=
/<wbr>discussion</a> ).<br></div><div>Additionally, people seems to be inte=
rested in detecting constexpr-ness (e.g. <a href=3D"http://stackoverflow.co=
m/questions/15232758/detecting-constexpr-with-sfinae" target=3D"_blank">htt=
p://stackoverflow.com/<wbr>questions/15232758/detecting-<wbr>constexpr-with=
-sfinae</a>) to achieve the same &quot;manually&quot;.<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></di=
v><div>int b =3D fun();=C2=A0=C2=A0 // b =3D 2<br><br></div><div><div>If th=
ere 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 clas=
s=3D"gmail-HOEnZb"><font color=3D"#888888"><br><br><br></font></span></div>=
<span class=3D"gmail-HOEnZb"><font color=3D"#888888"><div>-- <br><div class=
=3D"gmail-m_-298111473399651679gmail_signature">Who=E2=80=99s got the sweet=
est disposition?<br>One guess, that=E2=80=99s who?<br>Who=E2=80=99d never, =
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 fig=
ht?<br>Who get stuck with all the bad luck? </div>
</div></font></span></div><span class=3D"gmail-HOEnZb"><font color=3D"#8888=
88"><br></font></span></div><span class=3D"gmail-HOEnZb"><font color=3D"#88=
8888">

<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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/CAFdMc-2q3KpV%2Bm5cfWr6b02XmHVUdxsNCN=
AVFG%2BmzCv0QY7ZRg%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfoo=
ter" target=3D"_blank">https://groups.google.com/a/<wbr>isocpp.org/d/msgid/=
std-<wbr>proposals/CAFdMc-2q3KpV%<wbr>2Bm5cfWr6b02XmHVUdxsNCNAVFG%<wbr>2Bmz=
Cv0QY7ZRg%40mail.gmail.com</a><wbr>.<br>
</font></span></blockquote></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/CAOfiQqm4VgaS8OSeopB88dE68CNYRubwZa5H=
0f2F0rn6FsOWXw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOfiQqm4VgaS8OSe=
opB88dE68CNYRubwZa5H0f2F0rn6FsOWXw%40mail.gmail.com</a>.<br />

--001a11471460d53e2e054a169a4c--

.
