aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2025-03-15 00:15:36 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2025-03-27 13:47:30 +0100
commitaba3018af8e025a62a87c704ccad6714b13bc811 (patch)
tree02d7366a3ecf9cc6d76aead3292b61eefd94915f /libcpp
parent698ef4b29d875b9ab8903e95633f1473a29c217b (diff)
downloadgcc-aba3018af8e025a62a87c704ccad6714b13bc811.zip
gcc-aba3018af8e025a62a87c704ccad6714b13bc811.tar.gz
gcc-aba3018af8e025a62a87c704ccad6714b13bc811.tar.bz2
libstdc++: add constexpr stable_partition
This completes the implementation of P2562R1 for C++26. Unlike the other constexpr algorithms of the same family, stable_partition does not have a constexpr-friendly version "ready to use" during constant evaluation. In fact, it is not even available on freestanding, because it always allocates a temporary memory buffer. This commit implements the simplest possible strategy: during constant evaluation allocate a buffer of length 1 on the stack, and use that as a working area. libstdc++-v3/ChangeLog: * include/bits/algorithmfwd.h (stable_partition): Mark it as constexpr for C++26. * include/bits/ranges_algo.h (__stable_partition_fn): Likewise. * include/bits/stl_algo.h (stable_partition): Mark it as constexpr for C++26; during constant evaluation use a new codepath where a temporary buffer of 1 element is used. * testsuite/25_algorithms/headers/algorithm/synopsis.cc (stable_partition): Add constexpr. * testsuite/25_algorithms/stable_partition/constexpr.cc: New test.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions