[ Web Proxy ]
URL:
Viewing: http://ja.cppreference.com/cpp/string/basic_string/stof [Back]  [Original]

std::stof, std::stod, std::stold - cppreference.com
cppreference.com

std::stof, std::stod, std::stold

: cppreference.com
 
C++
(C++20)
(C++20)
(C++17)
(C++11)
(C++11)
(C++11)
 
 
std::basic_string
 
<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
  • ()
  • 10 ( C )
  • () e E10 10
  • 16
  • ()
  • 0x 0X
  • 16 ( C )
  • () p P10 2
  • ()
  • INF INFINITY
  • ()
  • NAN NAN(char_sequence) NAN char_sequence quiet NaN
  • C

pos ptr () str.c_str() *pos

str -
pos -

std::invalid_argument

(strtof (C++17)strtod strtold) errno ERANGE std::out_of_range

(C++11)(C++11)(C++11)

() [edit]
(C++11)(C++11)

() [edit]

() [edit]

Web Proxy Viewer  |  New URL  |  Original Page