Lines 2807-2847
Link Here
|
2807 |
// 21.4 Numeric Conversions [string.conversions]. |
2807 |
// 21.4 Numeric Conversions [string.conversions]. |
2808 |
inline int |
2808 |
inline int |
2809 |
stoi(const string& __str, size_t* __idx = 0, int __base = 10) |
2809 |
stoi(const string& __str, size_t* __idx = 0, int __base = 10) |
2810 |
{ return __gnu_cxx::__stoa<long, int>(&std::strtol, "stoi", __str.c_str(), |
2810 |
{ return __gnu_cxx::__stoa<int>(&std::strtol, "stoi", __str.c_str(), |
2811 |
__idx, __base); } |
2811 |
__idx, __base); } |
2812 |
|
2812 |
|
2813 |
inline long |
2813 |
inline long |
2814 |
stol(const string& __str, size_t* __idx = 0, int __base = 10) |
2814 |
stol(const string& __str, size_t* __idx = 0, int __base = 10) |
2815 |
{ return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(), |
2815 |
{ return __gnu_cxx::__stoa<long>(&std::strtol, "stol", __str.c_str(), |
2816 |
__idx, __base); } |
2816 |
__idx, __base); } |
2817 |
|
2817 |
|
2818 |
inline unsigned long |
2818 |
inline unsigned long |
2819 |
stoul(const string& __str, size_t* __idx = 0, int __base = 10) |
2819 |
stoul(const string& __str, size_t* __idx = 0, int __base = 10) |
2820 |
{ return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(), |
2820 |
{ return __gnu_cxx::__stoa<unsigned long>(&std::strtoul, "stoul", __str.c_str(), |
2821 |
__idx, __base); } |
2821 |
__idx, __base); } |
2822 |
|
2822 |
|
2823 |
inline long long |
2823 |
inline long long |
2824 |
stoll(const string& __str, size_t* __idx = 0, int __base = 10) |
2824 |
stoll(const string& __str, size_t* __idx = 0, int __base = 10) |
2825 |
{ return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(), |
2825 |
{ return __gnu_cxx::__stoa<long long>(&std::strtoll, "stoll", __str.c_str(), |
2826 |
__idx, __base); } |
2826 |
__idx, __base); } |
2827 |
|
2827 |
|
2828 |
inline unsigned long long |
2828 |
inline unsigned long long |
2829 |
stoull(const string& __str, size_t* __idx = 0, int __base = 10) |
2829 |
stoull(const string& __str, size_t* __idx = 0, int __base = 10) |
2830 |
{ return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(), |
2830 |
{ return __gnu_cxx::__stoa<unsigned long long>(&std::strtoull, "stoull", __str.c_str(), |
2831 |
__idx, __base); } |
2831 |
__idx, __base); } |
2832 |
|
2832 |
|
2833 |
// NB: strtof vs strtod. |
2833 |
// NB: strtof vs strtod. |
2834 |
inline float |
2834 |
inline float |
2835 |
stof(const string& __str, size_t* __idx = 0) |
2835 |
stof(const string& __str, size_t* __idx = 0) |
2836 |
{ return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); } |
2836 |
{ return __gnu_cxx::__stoa<float>(&std::strtof, "stof", __str.c_str(), __idx); } |
2837 |
|
2837 |
|
2838 |
inline double |
2838 |
inline double |
2839 |
stod(const string& __str, size_t* __idx = 0) |
2839 |
stod(const string& __str, size_t* __idx = 0) |
2840 |
{ return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); } |
2840 |
{ return __gnu_cxx::__stoa<double>(&std::strtod, "stod", __str.c_str(), __idx); } |
2841 |
|
2841 |
|
2842 |
inline long double |
2842 |
inline long double |
2843 |
stold(const string& __str, size_t* __idx = 0) |
2843 |
stold(const string& __str, size_t* __idx = 0) |
2844 |
{ return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } |
2844 |
{ return __gnu_cxx::__stoa<long double>(&std::strtold, "stold", __str.c_str(), __idx); } |
2845 |
|
2845 |
|
2846 |
// NB: (v)snprintf vs sprintf. |
2846 |
// NB: (v)snprintf vs sprintf. |
2847 |
|
2847 |
|
Lines 2910-2950
Link Here
|
2910 |
#ifdef _GLIBCXX_USE_WCHAR_T |
2910 |
#ifdef _GLIBCXX_USE_WCHAR_T |
2911 |
inline int |
2911 |
inline int |
2912 |
stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) |
2912 |
stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) |
2913 |
{ return __gnu_cxx::__stoa<long, int>(&std::wcstol, "stoi", __str.c_str(), |
2913 |
{ return __gnu_cxx::__stoa<int>(&std::wcstol, "stoi", __str.c_str(), |
2914 |
__idx, __base); } |
2914 |
__idx, __base); } |
2915 |
|
2915 |
|
2916 |
inline long |
2916 |
inline long |
2917 |
stol(const wstring& __str, size_t* __idx = 0, int __base = 10) |
2917 |
stol(const wstring& __str, size_t* __idx = 0, int __base = 10) |
2918 |
{ return __gnu_cxx::__stoa(&std::wcstol, "stol", __str.c_str(), |
2918 |
{ return __gnu_cxx::__stoa<long>(&std::wcstol, "stol", __str.c_str(), |
2919 |
__idx, __base); } |
2919 |
__idx, __base); } |
2920 |
|
2920 |
|
2921 |
inline unsigned long |
2921 |
inline unsigned long |
2922 |
stoul(const wstring& __str, size_t* __idx = 0, int __base = 10) |
2922 |
stoul(const wstring& __str, size_t* __idx = 0, int __base = 10) |
2923 |
{ return __gnu_cxx::__stoa(&std::wcstoul, "stoul", __str.c_str(), |
2923 |
{ return __gnu_cxx::__stoa<unsigned long>(&std::wcstoul, "stoul", __str.c_str(), |
2924 |
__idx, __base); } |
2924 |
__idx, __base); } |
2925 |
|
2925 |
|
2926 |
inline long long |
2926 |
inline long long |
2927 |
stoll(const wstring& __str, size_t* __idx = 0, int __base = 10) |
2927 |
stoll(const wstring& __str, size_t* __idx = 0, int __base = 10) |
2928 |
{ return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(), |
2928 |
{ return __gnu_cxx::__stoa<long long>(&std::wcstoll, "stoll", __str.c_str(), |
2929 |
__idx, __base); } |
2929 |
__idx, __base); } |
2930 |
|
2930 |
|
2931 |
inline unsigned long long |
2931 |
inline unsigned long long |
2932 |
stoull(const wstring& __str, size_t* __idx = 0, int __base = 10) |
2932 |
stoull(const wstring& __str, size_t* __idx = 0, int __base = 10) |
2933 |
{ return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(), |
2933 |
{ return __gnu_cxx::__stoa<unsigned long long>(&std::wcstoull, "stoull", __str.c_str(), |
2934 |
__idx, __base); } |
2934 |
__idx, __base); } |
2935 |
|
2935 |
|
2936 |
// NB: wcstof vs wcstod. |
2936 |
// NB: wcstof vs wcstod. |
2937 |
inline float |
2937 |
inline float |
2938 |
stof(const wstring& __str, size_t* __idx = 0) |
2938 |
stof(const wstring& __str, size_t* __idx = 0) |
2939 |
{ return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); } |
2939 |
{ return __gnu_cxx::__stoa<float>(&std::wcstof, "stof", __str.c_str(), __idx); } |
2940 |
|
2940 |
|
2941 |
inline double |
2941 |
inline double |
2942 |
stod(const wstring& __str, size_t* __idx = 0) |
2942 |
stod(const wstring& __str, size_t* __idx = 0) |
2943 |
{ return __gnu_cxx::__stoa(&std::wcstod, "stod", __str.c_str(), __idx); } |
2943 |
{ return __gnu_cxx::__stoa<double>(&std::wcstod, "stod", __str.c_str(), __idx); } |
2944 |
|
2944 |
|
2945 |
inline long double |
2945 |
inline long double |
2946 |
stold(const wstring& __str, size_t* __idx = 0) |
2946 |
stold(const wstring& __str, size_t* __idx = 0) |
2947 |
{ return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); } |
2947 |
{ return __gnu_cxx::__stoa<long double>(&std::wcstold, "stold", __str.c_str(), __idx); } |
2948 |
|
2948 |
|
2949 |
// DR 1261. |
2949 |
// DR 1261. |
2950 |
inline wstring |
2950 |
inline wstring |