stod

字符序列转换为 double。

double stod(
    const string& _Str, 
    size_t *_Idx = 0
);
double stod(
    const wstring& _Str, 
    size_t *_Idx = 0
;

参数

参数

说明

_Str

要转换的字符序列。

_Idx

第一个没有。字符的索引。

返回值

double 值。

备注

函数将元素转换序列。_Str 的值为 _Val 类型的 double,就像通过调用 strtod(_Str.c_str(), _Eptr),_Eptr 是内部个对象传递给函数。 如果该 _Str.c_str() == *_Eptr 引发 invalid_argument类型的对象。 如果此调用将 errno,则引发 out_of_range类型的对象。 否则,在中,如果 _Idx 不为空,*_Idx 指针的函数以存储 *_Eptr - _Str.c_str() 并返回 _Val。

要求

标头:< 字符串>

命名空间: std

请参见

参考

字符串(C++ STL <字符串>)

wstring

<string>