[libcxx-commits] [libcxx] [libc++][C++26] P2562R1: `constexpr` Stable Sorting (PR #110320)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Oct 12 02:18:51 PDT 2024
================
@@ -83,30 +106,35 @@ _LIBCPP_HIDE_FROM_ABI void __merge_move_construct(
for (; true; ++__result) {
if (__first1 == __last1) {
for (; __first2 != __last2; ++__first2, (void)++__result, __d.template __incr<value_type>())
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
+ __STABLE_SORT_NEW(__result, value_type, _Ops::__iter_move, __first2);
__h.release();
return;
}
if (__first2 == __last2) {
for (; __first1 != __last1; ++__first1, (void)++__result, __d.template __incr<value_type>())
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
+ __STABLE_SORT_NEW(__result, value_type, _Ops::__iter_move, __first1);
__h.release();
return;
}
if (__comp(*__first2, *__first1)) {
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first2));
+ __STABLE_SORT_NEW(__result, value_type, _Ops::__iter_move, __first2);
__d.template __incr<value_type>();
++__first2;
} else {
- ::new ((void*)__result) value_type(_Ops::__iter_move(__first1));
+// __STABLE_SORT_NEW(__result, value_type, _Ops::__iter_move, __first1);
+#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 <= 140100)
+ [__result, &__first1] { ::new (__result) value_type(_Ops::__iter_move(__first1)); }();
+#else
+ ::new (__result) value_type(_Ops::__iter_move(__first1));
----------------
PaulXiCao wrote:
Copy and paste error. I did that previously via macros but that also failed. I guess I will have to try the std::construct idea.
https://github.com/llvm/llvm-project/pull/110320
More information about the libcxx-commits
mailing list