From 703e43d05547df71f7b9437fa418ddd08d4dec02 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 24 Aug 2023 14:04:23 +0200 Subject: [PATCH] string: add some more helpers for locale manipulation Microsoft has nonstandard implementation. Signed-off-by: Simon Rozman --- include/stdex/string.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/stdex/string.hpp b/include/stdex/string.hpp index 5d3b20fd9..cabb28836 100644 --- a/include/stdex/string.hpp +++ b/include/stdex/string.hpp @@ -33,7 +33,12 @@ namespace stdex } }; - static std::unique_ptr<__crt_locale_pointers, free_locale_delete> locale_C(_create_locale(LC_ALL, "C")); + using locale = std::unique_ptr<__crt_locale_pointers, free_locale_delete>; + static locale locale_C(_create_locale(LC_ALL, "C")); + + inline locale_t create_locale(_In_ int category, _In_z_ const char* locale) { return _create_locale(category, locale); } + inline locale_t create_locale(_In_ int category, _In_z_ const wchar_t* locale) { return _wcreate_locale(category, locale); } + inline void free_locale(_In_opt_ _locale_t locale) { _free_locale(locale); } #else using locale_t = ::locale_t; #endif