[libcxx-commits] [libcxx] [libc++] Move numpunct into <__locale_dir/num.h> (PR #212465)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 28 04:22:32 PDT 2026
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/212465
`numpunct` is part of the `num` family of facets, so it should live in `num.h`.
>From 38925530ba173ce1dfa4e83afd679337d5ba2bd1 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Tue, 28 Jul 2026 13:21:03 +0200
Subject: [PATCH] [libc++] Move numpunct into <__locale_dir/num.h>
---
libcxx/include/__locale | 98 -------------------------------
libcxx/include/__locale_dir/num.h | 98 +++++++++++++++++++++++++++++++
2 files changed, 98 insertions(+), 98 deletions(-)
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index f878aa48071ca..28bc17f8368a6 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -1425,104 +1425,6 @@ struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<32> : public codecvt<char32_t
}
};
-// template <class charT> class numpunct
-
-template <class _CharT>
-class numpunct;
-
-template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct<char> : public locale::facet {
-public:
- typedef char char_type;
- typedef basic_string<char_type> string_type;
-
- explicit numpunct(size_t __refs = 0);
-
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
-
- static locale::id id;
-
-protected:
- ~numpunct() override;
- virtual char_type do_decimal_point() const;
- virtual char_type do_thousands_sep() const;
- virtual string do_grouping() const;
- virtual string_type do_truename() const;
- virtual string_type do_falsename() const;
-
- char_type __decimal_point_;
- char_type __thousands_sep_;
- string __grouping_;
-};
-
-# if _LIBCPP_HAS_WIDE_CHARACTERS
-template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct<wchar_t> : public locale::facet {
-public:
- typedef wchar_t char_type;
- typedef basic_string<char_type> string_type;
-
- explicit numpunct(size_t __refs = 0);
-
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
-
- static locale::id id;
-
-protected:
- ~numpunct() override;
- virtual char_type do_decimal_point() const;
- virtual char_type do_thousands_sep() const;
- virtual string do_grouping() const;
- virtual string_type do_truename() const;
- virtual string_type do_falsename() const;
-
- char_type __decimal_point_;
- char_type __thousands_sep_;
- string __grouping_;
-};
-# endif // _LIBCPP_HAS_WIDE_CHARACTERS
-
-// template <class charT> class numpunct_byname
-
-template <class _CharT>
-class numpunct_byname;
-
-template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<char> : public numpunct<char> {
-public:
- typedef char char_type;
- typedef basic_string<char_type> string_type;
-
- explicit numpunct_byname(const char* __nm, size_t __refs = 0);
- explicit numpunct_byname(const string& __nm, size_t __refs = 0);
-
-protected:
- ~numpunct_byname() override;
-};
-
-# if _LIBCPP_HAS_WIDE_CHARACTERS
-template <>
-class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<wchar_t> : public numpunct<wchar_t> {
-public:
- typedef wchar_t char_type;
- typedef basic_string<char_type> string_type;
-
- explicit numpunct_byname(const char* __nm, size_t __refs = 0);
- explicit numpunct_byname(const string& __nm, size_t __refs = 0);
-
-protected:
- ~numpunct_byname() override;
-};
-# endif // _LIBCPP_HAS_WIDE_CHARACTERS
-
_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__locale_dir/num.h b/libcxx/include/__locale_dir/num.h
index 5b3b917384121..d50d0e9ba4ab8 100644
--- a/libcxx/include/__locale_dir/num.h
+++ b/libcxx/include/__locale_dir/num.h
@@ -44,6 +44,104 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
+// template <class charT> class numpunct
+
+template <class _CharT>
+class numpunct;
+
+template <>
+class _LIBCPP_EXPORTED_FROM_ABI numpunct<char> : public locale::facet {
+public:
+ typedef char char_type;
+ typedef basic_string<char_type> string_type;
+
+ explicit numpunct(size_t __refs = 0);
+
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
+
+ static locale::id id;
+
+protected:
+ ~numpunct() override;
+ virtual char_type do_decimal_point() const;
+ virtual char_type do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual string_type do_truename() const;
+ virtual string_type do_falsename() const;
+
+ char_type __decimal_point_;
+ char_type __thousands_sep_;
+ string __grouping_;
+};
+
+# if _LIBCPP_HAS_WIDE_CHARACTERS
+template <>
+class _LIBCPP_EXPORTED_FROM_ABI numpunct<wchar_t> : public locale::facet {
+public:
+ typedef wchar_t char_type;
+ typedef basic_string<char_type> string_type;
+
+ explicit numpunct(size_t __refs = 0);
+
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type decimal_point() const { return do_decimal_point(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI char_type thousands_sep() const { return do_thousands_sep(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string grouping() const { return do_grouping(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type truename() const { return do_truename(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI string_type falsename() const { return do_falsename(); }
+
+ static locale::id id;
+
+protected:
+ ~numpunct() override;
+ virtual char_type do_decimal_point() const;
+ virtual char_type do_thousands_sep() const;
+ virtual string do_grouping() const;
+ virtual string_type do_truename() const;
+ virtual string_type do_falsename() const;
+
+ char_type __decimal_point_;
+ char_type __thousands_sep_;
+ string __grouping_;
+};
+# endif // _LIBCPP_HAS_WIDE_CHARACTERS
+
+// template <class charT> class numpunct_byname
+
+template <class _CharT>
+class numpunct_byname;
+
+template <>
+class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<char> : public numpunct<char> {
+public:
+ typedef char char_type;
+ typedef basic_string<char_type> string_type;
+
+ explicit numpunct_byname(const char* __nm, size_t __refs = 0);
+ explicit numpunct_byname(const string& __nm, size_t __refs = 0);
+
+protected:
+ ~numpunct_byname() override;
+};
+
+# if _LIBCPP_HAS_WIDE_CHARACTERS
+template <>
+class _LIBCPP_EXPORTED_FROM_ABI numpunct_byname<wchar_t> : public numpunct<wchar_t> {
+public:
+ typedef wchar_t char_type;
+ typedef basic_string<char_type> string_type;
+
+ explicit numpunct_byname(const char* __nm, size_t __refs = 0);
+ explicit numpunct_byname(const string& __nm, size_t __refs = 0);
+
+protected:
+ ~numpunct_byname() override;
+};
+# endif // _LIBCPP_HAS_WIDE_CHARACTERS
+
struct _LIBCPP_EXPORTED_FROM_ABI __num_get_base {
static const int __num_get_buf_sz = 40;
More information about the libcxx-commits
mailing list