libstdc++: Add additional overload of std::lerp [PR101870]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 12 Aug 2021 16:35:25 +0000 (17:35 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 12 Aug 2021 18:46:16 +0000 (19:46 +0100)
commit9017326e19fe278d5f62898cca4682b17f8e8e07
tree4d52aa17bdb30c2ffe9889dd75668bd0287d1752
parentb1c0e8599aa6ff5550dc748679e13c1eb492ee2c
libstdc++: Add additional overload of std::lerp [PR101870]

The [cmath.syn] p1 wording about additional overloads sufficient to
handle any arithmetic types also applies to std::lerp. This adds a new
overload of std::lerp that does the required promotions to support
arguments of arbitrary arithmetic types.

A new __promoted_t alias template is added, which the C++17 function
templates std::hypot and std::lerp can use to avoid instantiating the
__promote_3 class template.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

PR libstdc++/101870
* include/c_global/cmath (hypot): Use __promoted_t.
(lerp): Add new overload accepting any arithmetic types.
* include/ext/type_traits.h (__promoted_t): New alias template.
* testsuite/26_numerics/lerp.cc: Moved to...
* testsuite/26_numerics/lerp/1.cc: ...here.
* testsuite/26_numerics/lerp/constexpr.cc: New test.
* testsuite/26_numerics/lerp/version.cc: New test.
libstdc++-v3/include/c_global/cmath
libstdc++-v3/include/ext/type_traits.h
libstdc++-v3/testsuite/26_numerics/lerp/1.cc [moved from libstdc++-v3/testsuite/26_numerics/lerp.cc with 100% similarity]
libstdc++-v3/testsuite/26_numerics/lerp/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/lerp/version.cc [new file with mode: 0644]