tmp/tmpn595ka3p/{from.md → to.md}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
### Numeric conversions <a id="string.conversions">[[string.conversions]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
-
int stoi(const string& str, size_t* idx =
|
| 5 |
-
long stol(const string& str, size_t* idx =
|
| 6 |
-
unsigned long stoul(const string& str, size_t* idx =
|
| 7 |
-
long long stoll(const string& str, size_t* idx =
|
| 8 |
-
unsigned long long stoull(const string& str, size_t* idx =
|
| 9 |
```
|
| 10 |
|
| 11 |
-
*Effects:*
|
| 12 |
`strtol(str.c_str(), ptr, base)`, and the last three functions call
|
| 13 |
`strtoul(str.c_str(), ptr, base)`, `strtoll(str.c_str(), ptr, base)`,
|
| 14 |
and `strtoull(str.c_str(), ptr, base)`, respectively. Each function
|
| 15 |
returns the converted result, if any. The argument `ptr` designates a
|
| 16 |
pointer to an object internal to the function that is used to determine
|
|
@@ -25,13 +25,13 @@ unconverted element of `str`.
|
|
| 25 |
`out_of_range` if `strtol`, `strtoul`, `strtoll` or `strtoull` sets
|
| 26 |
`errno` to `ERANGE`, or if the converted value is outside the range of
|
| 27 |
representable values for the return type.
|
| 28 |
|
| 29 |
``` cpp
|
| 30 |
-
float stof(const string& str, size_t* idx =
|
| 31 |
-
double stod(const string& str, size_t* idx =
|
| 32 |
-
long double stold(const string& str, size_t* idx =
|
| 33 |
```
|
| 34 |
|
| 35 |
*Effects:* These functions call `strtof(str.c_str(), ptr)`,
|
| 36 |
`strtod(str.c_str(), ptr)`, and `strtold(str.c_str(), ptr)`,
|
| 37 |
respectively. Each function returns the converted result, if any. The
|
|
@@ -66,18 +66,18 @@ calling `sprintf(buf, fmt, val)` with a format specifier of `"%d"`,
|
|
| 66 |
`"%u"`, `"%ld"`, `"%lu"`, `"%lld"`, `"%llu"`, `"%f"`, `"%f"`, or
|
| 67 |
`"%Lf"`, respectively, where `buf` designates an internal character
|
| 68 |
buffer of sufficient size.
|
| 69 |
|
| 70 |
``` cpp
|
| 71 |
-
int stoi(const wstring& str, size_t* idx =
|
| 72 |
-
long stol(const wstring& str, size_t* idx =
|
| 73 |
-
unsigned long stoul(const wstring& str, size_t* idx =
|
| 74 |
-
long long stoll(const wstring& str, size_t* idx =
|
| 75 |
-
unsigned long long stoull(const wstring& str, size_t* idx =
|
| 76 |
```
|
| 77 |
|
| 78 |
-
*Effects:*
|
| 79 |
`wcstol(str.c_str(), ptr, base)`, and the last three functions call
|
| 80 |
`wcstoul(str.c_str(), ptr, base)`, `wcstoll(str.c_str(), ptr, base)`,
|
| 81 |
and `wcstoull(str.c_str(), ptr, base)`, respectively. Each function
|
| 82 |
returns the converted result, if any. The argument `ptr` designates a
|
| 83 |
pointer to an object internal to the function that is used to determine
|
|
@@ -91,13 +91,13 @@ unconverted element of `str`.
|
|
| 91 |
`wcstoull` reports that no conversion could be performed. Throws
|
| 92 |
`out_of_range` if the converted value is outside the range of
|
| 93 |
representable values for the return type.
|
| 94 |
|
| 95 |
``` cpp
|
| 96 |
-
float stof(const wstring& str, size_t* idx =
|
| 97 |
-
double stod(const wstring& str, size_t* idx =
|
| 98 |
-
long double stold(const wstring& str, size_t* idx =
|
| 99 |
```
|
| 100 |
|
| 101 |
*Effects:* These functions call `wcstof(str.c_str(), ptr)`,
|
| 102 |
`wcstod(str.c_str(), ptr)`, and `wcstold(str.c_str(), ptr)`,
|
| 103 |
respectively. Each function returns the converted result, if any. The
|
|
|
|
| 1 |
### Numeric conversions <a id="string.conversions">[[string.conversions]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
+
int stoi(const string& str, size_t* idx = nullptr, int base = 10);
|
| 5 |
+
long stol(const string& str, size_t* idx = nullptr, int base = 10);
|
| 6 |
+
unsigned long stoul(const string& str, size_t* idx = nullptr, int base = 10);
|
| 7 |
+
long long stoll(const string& str, size_t* idx = nullptr, int base = 10);
|
| 8 |
+
unsigned long long stoull(const string& str, size_t* idx = nullptr, int base = 10);
|
| 9 |
```
|
| 10 |
|
| 11 |
+
*Effects:* The first two functions call
|
| 12 |
`strtol(str.c_str(), ptr, base)`, and the last three functions call
|
| 13 |
`strtoul(str.c_str(), ptr, base)`, `strtoll(str.c_str(), ptr, base)`,
|
| 14 |
and `strtoull(str.c_str(), ptr, base)`, respectively. Each function
|
| 15 |
returns the converted result, if any. The argument `ptr` designates a
|
| 16 |
pointer to an object internal to the function that is used to determine
|
|
|
|
| 25 |
`out_of_range` if `strtol`, `strtoul`, `strtoll` or `strtoull` sets
|
| 26 |
`errno` to `ERANGE`, or if the converted value is outside the range of
|
| 27 |
representable values for the return type.
|
| 28 |
|
| 29 |
``` cpp
|
| 30 |
+
float stof(const string& str, size_t* idx = nullptr);
|
| 31 |
+
double stod(const string& str, size_t* idx = nullptr);
|
| 32 |
+
long double stold(const string& str, size_t* idx = nullptr);
|
| 33 |
```
|
| 34 |
|
| 35 |
*Effects:* These functions call `strtof(str.c_str(), ptr)`,
|
| 36 |
`strtod(str.c_str(), ptr)`, and `strtold(str.c_str(), ptr)`,
|
| 37 |
respectively. Each function returns the converted result, if any. The
|
|
|
|
| 66 |
`"%u"`, `"%ld"`, `"%lu"`, `"%lld"`, `"%llu"`, `"%f"`, `"%f"`, or
|
| 67 |
`"%Lf"`, respectively, where `buf` designates an internal character
|
| 68 |
buffer of sufficient size.
|
| 69 |
|
| 70 |
``` cpp
|
| 71 |
+
int stoi(const wstring& str, size_t* idx = nullptr, int base = 10);
|
| 72 |
+
long stol(const wstring& str, size_t* idx = nullptr, int base = 10);
|
| 73 |
+
unsigned long stoul(const wstring& str, size_t* idx = nullptr, int base = 10);
|
| 74 |
+
long long stoll(const wstring& str, size_t* idx = nullptr, int base = 10);
|
| 75 |
+
unsigned long long stoull(const wstring& str, size_t* idx = nullptr, int base = 10);
|
| 76 |
```
|
| 77 |
|
| 78 |
+
*Effects:* The first two functions call
|
| 79 |
`wcstol(str.c_str(), ptr, base)`, and the last three functions call
|
| 80 |
`wcstoul(str.c_str(), ptr, base)`, `wcstoll(str.c_str(), ptr, base)`,
|
| 81 |
and `wcstoull(str.c_str(), ptr, base)`, respectively. Each function
|
| 82 |
returns the converted result, if any. The argument `ptr` designates a
|
| 83 |
pointer to an object internal to the function that is used to determine
|
|
|
|
| 91 |
`wcstoull` reports that no conversion could be performed. Throws
|
| 92 |
`out_of_range` if the converted value is outside the range of
|
| 93 |
representable values for the return type.
|
| 94 |
|
| 95 |
``` cpp
|
| 96 |
+
float stof(const wstring& str, size_t* idx = nullptr);
|
| 97 |
+
double stod(const wstring& str, size_t* idx = nullptr);
|
| 98 |
+
long double stold(const wstring& str, size_t* idx = nullptr);
|
| 99 |
```
|
| 100 |
|
| 101 |
*Effects:* These functions call `wcstof(str.c_str(), ptr)`,
|
| 102 |
`wcstod(str.c_str(), ptr)`, and `wcstold(str.c_str(), ptr)`,
|
| 103 |
respectively. Each function returns the converted result, if any. The
|