Topic: constexpr std::min / std::max ?


Author: VinceRev <vince.rev@gmail.com>
Date: Wed, 5 Dec 2012 12:52:04 -0800 (PST)
Raw View
------=_Part_672_3432902.1354740724848
Content-Type: text/plain; charset=ISO-8859-1

Is there any particular reason why std::min and std::max are not constexpr ?
If not, it would be useful to have constexpr definitions for these two
functions in order to avoid the X < Y ? X : Y syntax in templates...
What do you think of that ?

And more generally I think it would be great to also convert all
mathematical functions of cmath to constexpr, in order to be able to do
more compile-time computations...


--




------=_Part_672_3432902.1354740724848
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Is there any particular reason why std::min and std::max are not constexpr =
?<br>If not, it would be useful to have constexpr definitions for these two=
 functions in order to avoid the X &lt; Y ? X : Y syntax in templates...<br=
>What do you think of that ?<br><br>And more generally I think it would be =
great to also convert all mathematical functions of cmath to constexpr, in =
order to be able to do more compile-time computations...<br><br><br>

<p></p>

-- <br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_672_3432902.1354740724848--

.


Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Wed, 5 Dec 2012 22:06:28 +0100
Raw View
--f46d042f97322e0c0904d0215bca
Content-Type: text/plain; charset=ISO-8859-1

After the publication of the c++11 standard, there have been some
discussions about this on stackoverflow. I remembered this:
http://stackoverflow.com/questions/5605142/stdmax-and-stdmin-not-constexpr

Joel Lamotte

--




--f46d042f97322e0c0904d0215bca
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

After the publication of the c++11 standard, there have been some discussio=
ns about this on stackoverflow. I remembered this:=A0<a href=3D"http://stac=
koverflow.com/questions/5605142/stdmax-and-stdmin-not-constexpr">http://sta=
ckoverflow.com/questions/5605142/stdmax-and-stdmin-not-constexpr</a><div>
<br></div><div>Joel Lamotte</div><div><br></div>

<p></p>

-- <br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />

--f46d042f97322e0c0904d0215bca--

.


Author: DeadMG <wolfeinstein@gmail.com>
Date: Sat, 8 Dec 2012 02:35:38 -0800 (PST)
Raw View
------=_Part_1823_7518797.1354962938138
Content-Type: text/plain; charset=ISO-8859-1

There are already fairly large swathes of functions due to become
constexpr. I don't recall the list, but it does exist somewhere. You might
want to check it.

--




------=_Part_1823_7518797.1354962938138
Content-Type: text/html; charset=ISO-8859-1

There are already fairly large swathes of functions due to become constexpr. I don't recall the list, but it does exist somewhere. You might want to check it.

<p></p>

-- <br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_1823_7518797.1354962938138--

.