[PATCH] D21343: Implement `lcm` and `gcd` from library fundamentals V2

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 14 17:29:20 PDT 2016


EricWF added a comment.

Gosh darn it Howard. Your like 10 minutes ahead of me.

Here is a constexpr gcd test.
https://gist.github.com/EricWF/46ea4489f405ec9f83325a278fe99535


================
Comment at: include/experimental/numeric:50
@@ +49,3 @@
+struct __abs<_Tp, true> {
+	_LIBCPP_INLINE_VISIBILITY _Tp operator()(_Tp __t) const noexcept { return _VSTD::abs(__t); }
+};
----------------
Both the call operator and `abs` are not constexpr.

================
Comment at: include/experimental/numeric:55
@@ +54,3 @@
+struct __abs<_Tp, false> {
+	_LIBCPP_INLINE_VISIBILITY _Tp operator()(_Tp __t) const noexcept { return __t; }
+};
----------------
Call operator is not constexpr.


http://reviews.llvm.org/D21343





More information about the cfe-commits mailing list