[PATCH 2/3] C++20 constexpr lib part 2/3 - swappish functions.

Jonathan Wakely jwakely@redhat.com
Tue Aug 13 11:24:00 GMT 2019


On 01/08/19 13:16 -0400, Ed Smith-Rowland via libstdc++ wrote:
>Greetings,
>
>Here is a patch for C++20 p0879 - Constexpr for swap and swap related 
>functions.
>
>This essentially constexprifies the rest of <algorithm>.
>
>Built and tested with C++20 (and pre-c++20) on x86_64-linux.
>
>Ok?
>
>Regards,
>
>Ed Smith-Rowland
>
>

>2019-08-01  Edward Smith-Rowland  <3dw4rd@verizon.net>
>
>	Implement C++20 p0879 - Constexpr for swap and swap related functions.
>	* include/bits/algorithmfwd.h (__cpp_lib_constexpr_swap_algorithms):
>	New macro. (iter_swap, make_heap, next_permutation, partial_sort_copy,

There should be a newline after "New macro." and before the next
parenthesized list of identifiers.

The parenthesized lists should not span multiple lines, so close and
reopen the parens, i.e.

        Implement C++20 p0879 - Constexpr for swap and swap related functions.
        * include/bits/algorithmfwd.h (__cpp_lib_constexpr_swap_algorithms):
        New macro.
        (iter_swap, make_heap, next_permutation, partial_sort_copy, pop_heap)
        (prev_permutation, push_heap, reverse, rotate, sort_heap, swap)
        (swap_ranges, nth_element, partial_sort, sort): Add constexpr.

>@@ -193,6 +193,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>
> #if __cplusplus > 201703L
> #  define __cpp_lib_constexpr_algorithms 201711L
>+#  define __cpp_lib_constexpr_swap_algorithms 201712L

Should this value be 201806L?

The new macro also needs to be added to <version>.



More information about the Gcc-patches mailing list