[libcxx-commits] [PATCH] D116295: [libc++] Add missing templated version of `std::lerp`

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jan 2 09:20:46 PST 2022


Mordante requested changes to this revision.
Mordante added a comment.
This revision now requires changes to proceed.

Seems copy-pasting missed some code improvements and required changes.



================
Comment at: libcxx/include/cmath:639
 
+template <class _A1, class _A2, class _A3>
+inline _LIBCPP_HIDE_FROM_ABI
----------------
The function should be `constexpr`. Please make sure to also update the test.


================
Comment at: libcxx/include/cmath:648
+>::type
+lerp(_A1 __a, _A2 __b, _A3 __t) _NOEXCEPT
+{
----------------
This function requires C++20.


================
Comment at: libcxx/include/cmath:653
+                     is_same<_A2, __result_type>::value &&
+                     is_same<_A3, __result_type>::value)), "");
+    return __lerp((__result_type)__a, (__result_type)__b, (__result_type)__t);
----------------



================
Comment at: libcxx/test/std/numerics/c.math/cmath.pass.cpp:1177
 
+void test_lerp()
+{
----------------
The file `libc++/test/std/numerics/c.math/c.math.lerp/c.math.lerp.pass.cpp` has the other `lerp` tests, please move this test to that file.


================
Comment at: libcxx/test/std/numerics/c.math/cmath.pass.cpp:1180
+#if TEST_STD_VER > 17
+    static_assert((std::is_same<decltype(std::lerp((float)0, (float)0, (float)0)), float>::value), "");
+    static_assert((std::is_same<decltype(std::lerp((float)0, (bool)0, (float)0)), double>::value), "");
----------------
Please remove the empty strings and use `std::is_same_v`.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116295/new/

https://reviews.llvm.org/D116295



More information about the libcxx-commits mailing list