[libcxx-commits] [libcxx] [llvm] [libc++] Implement P1885R12: `<text_encoding>` (PR #141312)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 3 21:19:33 PDT 2026


================
@@ -108,6 +110,12 @@ public:
     return std::use_facet<std::collate<_CharT> >(*this).compare(
                __x.data(), __x.data() + __x.size(), __y.data(), __y.data() + __y.size()) < 0;
   }
+#  if _LIBCPP_STD_VER >= 26
+  _LIBCPP_AVAILABILITY_TE_ENVIRONMENT _LIBCPP_HIDE_FROM_ABI std::text_encoding encoding() const {
+    std::string __name = name();
+    return std::__get_locale_encoding(__name.c_str());
----------------
frederick-vs-ja wrote:

Hmm, then how about taking `const locale&` instead? I think it's still possible to export only one symbol while avoiding copying the string.

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


More information about the libcxx-commits mailing list