diff options
Diffstat (limited to 'libcxx/src/string.cpp')
-rw-r--r-- | libcxx/src/string.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libcxx/src/string.cpp b/libcxx/src/string.cpp index 12db538..dc16ce7 100644 --- a/libcxx/src/string.cpp +++ b/libcxx/src/string.cpp @@ -14,7 +14,7 @@ #include <stdexcept> #include <string> -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include <cwchar> #endif @@ -40,12 +40,12 @@ void __basic_string_common<true>::__throw_out_of_range() const { std::__throw_ou #define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__; #ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char) -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t) # endif #else _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char) -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t) # endif #endif @@ -115,7 +115,7 @@ inline unsigned long long as_integer(const string& func, const string& s, size_t return as_integer_helper<unsigned long long>(func, s, idx, base, strtoull); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS // wstring template <> inline int as_integer(const string& func, const wstring& s, size_t* idx, int base) { @@ -145,7 +145,7 @@ template <> inline unsigned long long as_integer(const string& func, const wstring& s, size_t* idx, int base) { return as_integer_helper<unsigned long long>(func, s, idx, base, wcstoull); } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // as_float @@ -184,7 +184,7 @@ inline long double as_float(const string& func, const string& s, size_t* idx) { return as_float_helper<long double>(func, s, idx, strtold); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> inline float as_float(const string& func, const wstring& s, size_t* idx) { return as_float_helper<float>(func, s, idx, wcstof); @@ -199,7 +199,7 @@ template <> inline long double as_float(const string& func, const wstring& s, size_t* idx) { return as_float_helper<long double>(func, s, idx, wcstold); } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS } // unnamed namespace @@ -223,7 +223,7 @@ double stod(const string& str, size_t* idx) { return as_float<double>("stod", st long double stold(const string& str, size_t* idx) { return as_float<long double>("stold", str, idx); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS int stoi(const wstring& str, size_t* idx, int base) { return as_integer<int>("stoi", str, idx, base); } long stol(const wstring& str, size_t* idx, int base) { return as_integer<long>("stol", str, idx, base); } @@ -243,7 +243,7 @@ float stof(const wstring& str, size_t* idx) { return as_float<float>("stof", str double stod(const wstring& str, size_t* idx) { return as_float<double>("stod", str, idx); } long double stold(const wstring& str, size_t* idx) { return as_float<long double>("stold", str, idx); } -#endif // !_LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // to_string @@ -283,7 +283,7 @@ struct initial_string<string> { } }; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> struct initial_string<wstring> { wstring operator()() const { @@ -302,7 +302,7 @@ inline wide_printf get_swprintf() { return static_cast<int(__cdecl*)(wchar_t* __restrict, size_t, const wchar_t* __restrict, ...)>(_snwprintf); # endif } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS template <typename S, typename V> S i_to_string(V v) { @@ -325,7 +325,7 @@ string to_string(unsigned val) { return i_to_string< string>(val); } string to_string(unsigned long val) { return i_to_string< string>(val); } string to_string(unsigned long long val) { return i_to_string< string>(val); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS wstring to_wstring(int val) { return i_to_string<wstring>(val); } wstring to_wstring(long val) { return i_to_string<wstring>(val); } wstring to_wstring(long long val) { return i_to_string<wstring>(val); } @@ -338,7 +338,7 @@ string to_string(float val) { return as_string(snprintf, initial_string< string> string to_string(double val) { return as_string(snprintf, initial_string< string>()(), "%f", val); } string to_string(long double val) { return as_string(snprintf, initial_string< string>()(), "%Lf", val); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS wstring to_wstring(float val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); } wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); } wstring to_wstring(long double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%Lf", val); } |