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

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sun May 25 21:13:25 PDT 2025


================
@@ -0,0 +1,49 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#include <__locale_dir/locale_base_api.h>
+
+#include <text_encoding>
+
+#if __has_include(<langinfo.h>)
+#  include <langinfo.h>
+#endif
+
+#if _LIBCPP_STD_VER >= 26
----------------
frederick-vs-ja wrote:

The library needs to be built with `-std=c++26` (or in an even later mode) as long as `text_encoding::environment` is separately compiled. So it doesn't make sense to guard this with `_LIBCPP_STD_VER >= 26`.

Alternatively, it's possible to provide an internal function achieving this functionality that's separately compiled and available in old modes. But it still makes no sense to guard the function definition in `src/`.

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


More information about the libcxx-commits mailing list