[libcxx-commits] [libcxx] [libc++] Optimize std::swap of locales (PR #209760)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 29 07:38:29 PDT 2026


================
@@ -143,8 +143,14 @@ private:
   friend bool has_facet(const locale&) _NOEXCEPT;
   template <class _Facet>
   friend const _Facet& use_facet(const locale&);
+
+  friend void swap(locale&, locale&);
 };
 
+inline void swap(locale& __lhs, locale& __rhs) {
----------------
ldionne wrote:

I think the swap issue, while real, is also very pedantic, and I don't think it makes sense to block this patch on it. @philnik777 Would you mind creating a LWG issue for this? I think adding a new `swap` overload is probably the simplest thing here, and it's arguably non-evolutionary (whereas adding a move constructor to `locale` is definitely LEWG territory).

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


More information about the libcxx-commits mailing list