[libcxx-commits] [libcxx] [libc++] Support `constexpr` for `std::stable_sort` in radix sort branch (PR #125284)

Дмитрий Изволов via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 3 11:09:41 PST 2025


================
@@ -253,6 +253,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void __stable_sort(
   if constexpr (__allowed_radix_sort) {
     if (__len <= __buff_size && __len >= static_cast<difference_type>(__radix_sort_min_bound<value_type>()) &&
         __len <= static_cast<difference_type>(__radix_sort_max_bound<value_type>())) {
+      for (auto* __p = __buff; __p < __buff + __buff_size; ++__p) {
+        std::__construct_at(__p, 0);
+      }
+      __destruct_n __d(__buff_size);
+      unique_ptr<value_type, __destruct_n&> __h2(__buff, __d);
----------------
izvolov wrote:

Yes, you're right.
Done all three things.

https://github.com/llvm/llvm-project/pull/125284


More information about the libcxx-commits mailing list