From dc8a9a03ecdba4280ae15b890725ae30ad55ff60 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 24 May 2022 11:22:43 -0400 Subject: [PATCH] [libc++][NFC] Move definitions around in string.cpp to reduce _LIBCPP_HAS_NO_WIDE_CHARACTERS blocks --- libcxx/src/string.cpp | 100 ++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 57 deletions(-) diff --git a/libcxx/src/string.cpp b/libcxx/src/string.cpp index 9d1de0c..d847ad5 100644 --- a/libcxx/src/string.cpp +++ b/libcxx/src/string.cpp @@ -288,98 +288,42 @@ stoi(const string& str, size_t* idx, int base) return as_integer( "stoi", str, idx, base ); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -int -stoi(const wstring& str, size_t* idx, int base) -{ - return as_integer( "stoi", str, idx, base ); -} -#endif - long stol(const string& str, size_t* idx, int base) { return as_integer( "stol", str, idx, base ); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -long -stol(const wstring& str, size_t* idx, int base) -{ - return as_integer( "stol", str, idx, base ); -} -#endif - unsigned long stoul(const string& str, size_t* idx, int base) { return as_integer( "stoul", str, idx, base ); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -unsigned long -stoul(const wstring& str, size_t* idx, int base) -{ - return as_integer( "stoul", str, idx, base ); -} -#endif - long long stoll(const string& str, size_t* idx, int base) { return as_integer( "stoll", str, idx, base ); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -long long -stoll(const wstring& str, size_t* idx, int base) -{ - return as_integer( "stoll", str, idx, base ); -} -#endif - unsigned long long stoull(const string& str, size_t* idx, int base) { return as_integer( "stoull", str, idx, base ); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -unsigned long long -stoull(const wstring& str, size_t* idx, int base) -{ - return as_integer( "stoull", str, idx, base ); -} -#endif - float stof(const string& str, size_t* idx) { return as_float( "stof", str, idx ); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -float -stof(const wstring& str, size_t* idx) -{ - return as_float( "stof", str, idx ); -} -#endif - double stod(const string& str, size_t* idx) { return as_float( "stod", str, idx ); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -double -stod(const wstring& str, size_t* idx) -{ - return as_float( "stod", str, idx ); -} -#endif - long double stold(const string& str, size_t* idx) { @@ -387,12 +331,54 @@ stold(const string& str, size_t* idx) } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +int +stoi(const wstring& str, size_t* idx, int base) +{ + return as_integer( "stoi", str, idx, base ); +} + +long +stol(const wstring& str, size_t* idx, int base) +{ + return as_integer( "stol", str, idx, base ); +} + +unsigned long +stoul(const wstring& str, size_t* idx, int base) +{ + return as_integer( "stoul", str, idx, base ); +} + +long long +stoll(const wstring& str, size_t* idx, int base) +{ + return as_integer( "stoll", str, idx, base ); +} + +unsigned long long +stoull(const wstring& str, size_t* idx, int base) +{ + return as_integer( "stoull", str, idx, base ); +} + +float +stof(const wstring& str, size_t* idx) +{ + return as_float( "stof", str, idx ); +} + +double +stod(const wstring& str, size_t* idx) +{ + return as_float( "stod", str, idx ); +} + long double stold(const wstring& str, size_t* idx) { return as_float( "stold", str, idx ); } -#endif +#endif // !_LIBCPP_HAS_NO_WIDE_CHARACTERS // to_string -- 2.7.4