stold
将字符序列转换为 long double。
double stold( const string& _Str, size_t *_Idx = 0 ); double stold( const wstring& _Str, size_t *_Idx = 0 );
参数
参数 |
描述 |
---|---|
_Str |
要转换的字符序列。 |
_Idx |
首个未转换字符的索引值。 |
返回值
long double 值。
备注
该函数将 _Str 中元素的序列转换为类型 long double 的值 _Val,就像通过调用 strtold(_Str.c_str(), _Eptr) 实现一样,其中,_Eptr 是该函数的内部对象。 如果 _Str.c_str() == *_Eptr,它将引发 invalid_argument 类型的对象。 如果此类调用将设置 errno,它将引发 out_of_range 类型的对象。 否则,如果 _Idx 不是 null 指针,该函数会将 *_Eptr - _Str.c_str() 存储在 *_Idx 中并返回 _Val。
要求
标头:<string>
命名空间: std