std::stof, std::stod, std::stold
: cppreference.com
<tbody>
</tbody>
float stof( const std::string& str, std::size_t* pos = 0 ); float stof( const std::wstring& str, std::size_t* pos = 0 ); |
(1) | (C++11) |
double stod( const std::string& str, std::size_t* pos = 0 ); double stod( const std::wstring& str, std::size_t* pos = 0 ); |
(2) | (C++11) |
long double stold( const std::string& str, std::size_t* pos = 0 ); long double stold( const std::wstring& str, std::size_t* pos = 0 ); |
(3) | (C++11) |
str
|
1) std::strtod(str.c_str(), &ptr) std::wcstod(str.c_str(), &ptr)
|
(C++17) |
|
1) std::strtof(str.c_str(), &ptr) std::wcstof(str.c_str(), &ptr)
|
(C++17) |
2)
std::strtod(str.c_str(), &ptr) std::wcstod(str.c_str(), &ptr) 3)
std::strtold(str.c_str(), &ptr) std::wcstold(str.c_str(), &ptr) ( std::isspace() )
- 10
- 16
- ()
INFINFINITY
- ()
NANNAN(char_sequence)NANchar_sequence quiet NaN
pos ptr () str.c_str() *pos
| str | - | |
| pos | - |
(strtof (C++17)strtod strtold) errno ERANGE std::out_of_range
(C++11)(C++11)(C++11) |
() |
(C++11)(C++11) |
() |
(C++17) |
() |