[libcxx-commits] [libcxx] [libc++] Add the __is_replaceable type trait (PR #132408)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 25 06:26:45 PDT 2025


================
@@ -50,8 +50,11 @@ _LIBCPP_HIDE_FROM_ABI const _Facet& use_facet(const locale&);
 
 class _LIBCPP_EXPORTED_FROM_ABI locale {
 public:
-  // locale is essentially a shared_ptr that doesn't support weak_ptrs and never got a move constructor.
+  // locale is essentially a shared_ptr that doesn't support weak_ptrs and never got a move constructor,
+  // so it is trivially relocatable. However, it is not replaceable because self-assignment must prevent
+  // the refcount from hitting 0.
----------------
philnik777 wrote:

Same here.

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


More information about the libcxx-commits mailing list