[PATCH] libstdc++: P1645R1 constexpr for <numeric> algorithms

Jonathan Wakely jwakely@redhat.com
Fri Feb 28 18:19:00 GMT 2020


On 28/02/20 12:57 -0500, Patrick Palka wrote:
>On Fri, 28 Feb 2020, Jonathan Wakely wrote:
>
>> On 26/02/20 10:28 -0500, Patrick Palka wrote:
>> > On Wed, 26 Feb 2020, Jonathan Wakely wrote:
>> >
>> > > On 25/02/20 15:36 -0500, Patrick Palka wrote:
>> > > > This adds constexpr to 11 algorithms defined in <numeric> as per
>> > > P1645R1.
>> > > >
>> > > > Tested on x86_64-pc-linux-gnu, OK to commit?
>> > > >
>> > > > 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 (reduce, transform_reduce, exclusive_scan,
>> > > > 	inclusive_scan, transform_exclusive_scan, transform_inclusive_scan):
>> > > > 	Likewise.  Define the feature test macro __cpp_lib_constexpr_numeric.
>> > > > 	* 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.
>>
>> testsuite/26_numerics/headers/numeric/synopsis.cc is now failing when
>> run with -std=gnu++2a.
>>
>> For testsuite/25_algorithms/headers/algorithm/synopsis.cc we just
>> added _GLIBCXX20_CONSTEXPR to the test as needed.
>
>Does this look OK to commit?

Yes, thanks.



More information about the Libstdc++ mailing list