libstdc++: P1645R1 constexpr for <numeric> algorithms
authorPatrick Palka <ppalka@redhat.com>
Tue, 25 Feb 2020 19:40:41 +0000 (14:40 -0500)
committerPatrick Palka <ppalka@redhat.com>
Wed, 26 Feb 2020 15:23:17 +0000 (10:23 -0500)
commitfd335985582cbb9de3a08e071e652bb38960b493
treefc771c2e5fd26b2de28ddcecfdf120e8eb6077b7
parent113f0a639dbdd78048373a253ec64145ead7d29d
libstdc++: P1645R1 constexpr for <numeric> algorithms

This adds constexpr to 11 algorithms defined in <numeric> as per P1645R1.

libstdc++-v3/ChangeLog:

P1645R1 constexpr for <numeric> algorithms
* include/bits/stl_numeric.h (iota, accumulate, inner_product,
partial_sum, adjacent_difference): Make conditionally constexpr for
C++20.
* include/std/numeric (__cpp_lib_constexpr_numeric): Define this feature
test macro.
(reduce, transform_reduce, exclusive_scan, inclusive_scan,
transform_exclusive_scan, transform_inclusive_scan): Make conditionally
constexpr for C++20.
* include/std/version (__cpp_lib_constexpr_numeric): Define.
* testsuite/26_numerics/accumulate/constexpr.cc: New test.
* testsuite/26_numerics/adjacent_difference/constexpr.cc: Likewise.
* testsuite/26_numerics/exclusive_scan/constexpr.cc: Likewise.
* testsuite/26_numerics/inclusive_scan/constexpr.cc: Likewise.
* testsuite/26_numerics/inner_product/constexpr.cc: Likewise.
* testsuite/26_numerics/iota/constexpr.cc: Likewise.
* testsuite/26_numerics/partial_sum/constexpr.cc: Likewise.
* testsuite/26_numerics/reduce/constexpr.cc: Likewise.
* testsuite/26_numerics/transform_exclusive_scan/constexpr.cc: Likewise.
* testsuite/26_numerics/transform_inclusive_scan/constexpr.cc: Likewise.
* testsuite/26_numerics/transform_reduce/constexpr.cc: Likewise.
15 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_numeric.h
libstdc++-v3/include/std/numeric
libstdc++-v3/include/std/version
libstdc++-v3/testsuite/26_numerics/accumulate/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/adjacent_difference/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/exclusive_scan/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/inclusive_scan/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/inner_product/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/iota/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/partial_sum/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/reduce/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/transform_exclusive_scan/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/transform_inclusive_scan/constexpr.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/transform_reduce/constexpr.cc [new file with mode: 0644]