Topic: constexpr function parameters
Author: Vimmy <me@vimarshraina.com>
Date: Wed, 30 Nov 2016 08:36:44 -0800 (PST)
Raw View
------=_Part_12960_489678414.1480523804146
Content-Type: multipart/alternative;
boundary="----=_Part_12961_258514887.1480523804146"
------=_Part_12961_258514887.1480523804146
Content-Type: text/plain; charset=UTF-8
Currently there is no direct way check if a function parameters are being
resolved at compile time without long winding checks. How well would it
work if constexpr functioned as a compile time switch while also
participating in the type system as such:
void foo(constexpr int val) {
static_assert(val <= 42); //during compile time
}
void foo(int val) {
assert(val <= 42); //during runtime
}
Allows for a much cleaner implementation and without template code which
was also the intended purpose of if constexpr
--
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/7fcb1ef2-aed3-4ecb-923f-41d15eaf2d06%40isocpp.org.
------=_Part_12961_258514887.1480523804146
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Currently there is no direct way check if a function param=
eters are being resolved at compile time without long winding checks. How w=
ell would it work if <font face=3D"courier new, monospace">constexpr=C2=A0<=
/font>functioned as a compile time switch while also participating in the t=
ype system as such:<br><div><br></div><div class=3D"prettyprint" style=3D"b=
ackground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); bord=
er-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"=
prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> foo</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">constexpr</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> val</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">static_assert</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">val </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify"><=3D</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">42</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//during c=
ompile time</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">void</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> foo</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> val</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>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">assert</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">val=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><=3D</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #066;" class=3D"styled-by-prettify">42</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;"=
class=3D"styled-by-prettify">//during runtime</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">}</span></div></code></div><div><div><br></di=
v></div><div><br></div><div>Allows for a much cleaner implementation and wi=
thout template code which was also the intended purpose of <font face=3D"co=
urier new, monospace">if constexpr</font><br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/7fcb1ef2-aed3-4ecb-923f-41d15eaf2d06%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7fcb1ef2-aed3-4ecb-923f-41d15eaf2d06=
%40isocpp.org</a>.<br />
------=_Part_12961_258514887.1480523804146--
------=_Part_12960_489678414.1480523804146--
.
Author: "D. B." <db0451@gmail.com>
Date: Wed, 30 Nov 2016 16:38:59 +0000
Raw View
--047d7bb04c147e696305428757b8
Content-Type: text/plain; charset=UTF-8
c.f.
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/bf451b11-8305-4323-9bde-c1c4ecb125d8%40isocpp.org?utm_medium=email&utm_source=footer
--
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/CACGiwhF7j6ZoMKec%2BX5k6rQ1fh18NhCbJgbFbeHmUrd8E%2B3LxA%40mail.gmail.com.
--047d7bb04c147e696305428757b8
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">c.f. <a href=3D"https://groups.google.com/a/isocpp.org/d/m=
sgid/std-proposals/bf451b11-8305-4323-9bde-c1c4ecb125d8%40isocpp.org?utm_me=
dium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/isocpp.or=
g/d/msgid/std-proposals/bf451b11-8305-4323-9bde-c1c4ecb125d8%40isocpp.org?u=
tm_medium=3Demail&utm_source=3Dfooter</a><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CACGiwhF7j6ZoMKec%2BX5k6rQ1fh18NhCbJg=
bFbeHmUrd8E%2B3LxA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACGiwhF7j6Zo=
MKec%2BX5k6rQ1fh18NhCbJgbFbeHmUrd8E%2B3LxA%40mail.gmail.com</a>.<br />
--047d7bb04c147e696305428757b8--
.
Author: DrunkCompiler <me@vimarshraina.com>
Date: Wed, 30 Nov 2016 08:42:24 -0800 (PST)
Raw View
------=_Part_2140_1050487189.1480524144974
Content-Type: multipart/alternative;
boundary="----=_Part_2141_876442029.1480524144975"
------=_Part_2141_876442029.1480524144975
Content-Type: text/plain; charset=UTF-8
Looks like I haven't Googled hard enough, thanks!!
On Wednesday, November 30, 2016 at 4:39:01 PM UTC, D. B. wrote:
>
> c.f.
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/bf451b11-8305-4323-9bde-c1c4ecb125d8%40isocpp.org?utm_medium=email&utm_source=footer
>
--
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/4ffe1da7-c86e-4fc1-b7f3-8272d6c401e9%40isocpp.org.
------=_Part_2141_876442029.1480524144975
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Looks like I haven't Googled hard enough, thanks!!<br>=
<br>On Wednesday, November 30, 2016 at 4:39:01 PM UTC, D. B. wrote:<blockqu=
ote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left=
: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">c.f. <a href=3D"https=
://groups.google.com/a/isocpp.org/d/msgid/std-proposals/bf451b11-8305-4323-=
9bde-c1c4ecb125d8%40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" =
target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'https://=
groups.google.com/a/isocpp.org/d/msgid/std-proposals/bf451b11-8305-4323-9bd=
e-c1c4ecb125d8%40isocpp.org?utm_medium\x3demail\x26utm_source\x3dfooter'=
;;return true;" onclick=3D"this.href=3D'https://groups.google.com/a/iso=
cpp.org/d/msgid/std-proposals/bf451b11-8305-4323-9bde-c1c4ecb125d8%40isocpp=
..org?utm_medium\x3demail\x26utm_source\x3dfooter';return true;">https:/=
/groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/bf451b11-83=
05-4323-<wbr>9bde-c1c4ecb125d8%40isocpp.<wbr>org?utm_medium=3Demail&utm=
_<wbr>source=3Dfooter</a><br></div>
</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/4ffe1da7-c86e-4fc1-b7f3-8272d6c401e9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/4ffe1da7-c86e-4fc1-b7f3-8272d6c401e9=
%40isocpp.org</a>.<br />
------=_Part_2141_876442029.1480524144975--
------=_Part_2140_1050487189.1480524144974--
.