220 31455 <CAFdMc-2q3KpV+m5cfWr6b02XmHVUdxsNCNAVFG+mzCv0QY7ZRg@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: "dgutson ." <danielgutson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: overloading by constexpr (round 2?)
Date: Mon, 6 Mar 2017 15:15:51 -0300
Lines: 110
Approved: news@gmane.org
Message-ID: <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=94eb2c047d42bd2b8b054a13e246
X-Trace: blaine.gmane.org 1488824156 4686 195.159.176.226 (6 Mar 2017 18:15:56 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 6 Mar 2017 18:15:56 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDE3NBMV6UFBBWOO63CQKGQEBM4EJVI@isocpp.org Mon Mar 06 19:15:50 2017
Return-path: <std-proposals+bncBDE3NBMV6UFBBWOO63CQKGQEBM4EJVI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pg0-f72.google.com ([74.125.83.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDE3NBMV6UFBBWOO63CQKGQEBM4EJVI@isocpp.org>)
	id 1ckxAi-0000S7-D7
	for gclcip-std-proposals@m.gmane.org; Mon, 06 Mar 2017 19:15:48 +0100
Original-Received: by mail-pg0-f72.google.com with SMTP id e5sf33004135pgk.1
        for <gclcip-std-proposals@m.gmane.org>; Mon, 06 Mar 2017 10:15:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version: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=/mPhJJsHoK8/cOZRyh5w79Vc0+PTz+Rf9vcNGFgib18=;
        b=V/TMUZdikpcRbZlIPg3uL43qkqqty449H7IHkLmV64Koebf2v8plZ8TLw9gxIDrZFz
         81hK4D4UsWsc7y6r2krfV/4Y+p46Us/yzOlHworqFcXrh3XIApNwiD+lWthQCaXs795Y
         5byaka2kSerLTQBKtCPmi1I9IFErAu5Ujs9AUMAvlgBK4bHaYLhix6hQ64FgqBF1KiWx
         EmpMqB9KXq5iV5cBKvgw6OHBY8I9ZKI0fXOHW5iPzxDm2s+fa2C105m39P84GDk08XnA
         zrGRy7xHW6aq/NU7mHQ2Nv4BDWcj+toyrFlYtWO9tw3PMUwervWIAxzdDWANxK9w1Cbx
         6+qw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version: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=/mPhJJsHoK8/cOZRyh5w79Vc0+PTz+Rf9vcNGFgib18=;
        b=OhAgS75c8/DPGc2/DrHEwt1bDCcR6xYYAK4ExIpTyFGdv96hU829tHbdmAjCf8bN3m
         QlmVy4gICRjZVyKov/f6L0GTr7qEaBXLYrHlzu3xldBPmmEvcDjY5OwMKwF2VYx5EVYK
         r3JipcH1QD1sfdkd0VtsCue2GTjXSNoyNNQq9LzB8nyauOx5fQBkkhfgcUrCtx8P+NcB
         GzCnEhZxSC4AlPf0Le7v0SSId1WAVabih7QigANT0scwKX29h/qNQr8jzdCxPYA/YsQy
         31rRikBErkyVM9Co6H0V7cxEMWzxHDV2mQs4PRQiP5IZ7qmf3xF9UsMCnQ5Vx/Hi/9NL
         mu5w==
X-Gm-Message-State: AMke39lav0UkGNNOsUVK6V6EdzaEi5RsO+efKTljLw1/t+WZl+ixk8hDevXelTxZQQfBrA==
X-Received: by 10.99.149.81 with SMTP id t17mr7156998pgn.62.1488824153953;
        Mon, 06 Mar 2017 10:15:53 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.4.119 with SMTP id 110ls15309225otc.44.gmail; Mon, 06 Mar
 2017 10:15:52 -0800 (PST)
X-Received: by 10.159.48.141 with SMTP id j13mr6138263uab.42.1488824152812;
        Mon, 06 Mar 2017 10:15:52 -0800 (PST)
Original-Received: from mail-ua0-x22f.google.com (mail-ua0-x22f.google.com. [2607:f8b0:400c:c08::22f])
        by mx.google.com with ESMTPS id w2si7090776uaf.32.2017.03.06.10.15.52
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 06 Mar 2017 10:15:52 -0800 (PST)
Received-SPF: pass (google.com: domain of danielgutson@gmail.com designates 2607:f8b0:400c:c08::22f as permitted sender) client-ip=2607:f8b0:400c:c08::22f;
Original-Received: by mail-ua0-x22f.google.com with SMTP id u30so46950577uau.0
        for <std-proposals@isocpp.org>; Mon, 06 Mar 2017 10:15:52 -0800 (PST)
X-Received: by 10.176.6.167 with SMTP id g36mr6672603uag.10.1488824152433;
 Mon, 06 Mar 2017 10:15:52 -0800 (PST)
Original-Received: by 10.103.64.13 with HTTP; Mon, 6 Mar 2017 10:15:51 -0800 (PST)
X-Original-Sender: danielgutson@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 danielgutson@gmail.com designates 2607:f8b0:400c:c08::22f as permitted
 sender) smtp.mailfrom=danielgutson@gmail.com;       dmarc=pass (p=NONE
 sp=NONE dis=NONE) header.from=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:31455
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31455>

--94eb2c047d42bd2b8b054a13e246
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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/di=
scussion
).
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 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
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/CAFdMc-2q3KpV%2Bm5cfWr6b02XmHVUdxsNCNAVFG%2BmzCv=
0QY7ZRg%40mail.gmail.com.

--94eb2c047d42bd2b8b054a13e246
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div>I&#39;m proposing the ability to provide two ver=
sions 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">https://groups.google.com=
/a/isocpp.org/d/topic/std-proposals/oxijwTY-ft4/discussion</a> ).<br></div>=
<div>Additionally, people seems to be interested in detecting constexpr-nes=
s (e.g. <a href=3D"http://stackoverflow.com/questions/15232758/detecting-co=
nstexpr-with-sfinae">http://stackoverflow.com/questions/15232758/detecting-=
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>c=
onstexpr 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 retur=
n 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 Da=
niel.<br><br><br></div><div>-- <br><div class=3D"gmail_signature">Who=E2=80=
=99s got the sweetest 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 tempe=
rament?<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></div><br></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/CAFdMc-2q3KpV%2Bm5cfWr6b02XmHVUdxsNCN=
AVFG%2BmzCv0QY7ZRg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFdMc-2q3KpV=
%2Bm5cfWr6b02XmHVUdxsNCNAVFG%2BmzCv0QY7ZRg%40mail.gmail.com</a>.<br />

--94eb2c047d42bd2b8b054a13e246--

.
