[libcxx-commits] [PATCH] D154613: [libc++] Fix std::move algorithm with trivial move-only types

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 7 15:10:08 PDT 2023


philnik accepted this revision.
philnik added a comment.
This revision is now accepted and ready to land.

LGTM with a comment.



================
Comment at: libcxx/include/__string/constexpr_c_functions.h:171
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp& __assign_trivially_copyable(_Tp& __dest, _Up const& __src) {
+  std::__construct_at(std::addressof(__dest), __src);
+  return __dest;
----------------
Could you add a comment here explaining that we implicitly end the lifetime of the old object and then start the lifetime of the new object? I think this is a quite obscure part of the standard.


================
Comment at: libcxx/include/__string/constexpr_c_functions.h:179
+                                              !is_constructible<_Tp, _Up const&>::value &&
+                                               is_constructible<_Tp, _Up&&>::value, int> = 0>
+// clang-format on
----------------
Having `if constexpr` would make this so much nicer :(


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154613/new/

https://reviews.llvm.org/D154613



More information about the libcxx-commits mailing list