Udostępnij za pośrednictwem


stoll

Converts a character sequence to a long long.

long long stoll(
    const string& _Str, 
    size_t *_Idx = 0,
    int _Base = 10
);
long long stoll(
    const wstring& _Str, 
    size_t *_Idx = 0,
    int _Base = 10
);

Parameters

Parameter

Description

_Str

The character sequence to be converted.

_Idx

The index value of the first unconverted character.

_Base

The number base to use.

Return Value

The long long value.

Remarks

The function converts the sequence of elements in _Str to a value _Val of type long long as if by calling strtoll(_Str.c_str(), _Eptr, _Base), where _Eptr is an object internal to the function. If _Str.c_str() == *_Eptr it throws an object of type invalid_argument. If such a call would set errno, it throws an object of type out_of_range. Otherwise, if _Idx is not a null pointer, the function stores *_Eptr - _Str.c_str() in *_Idx and returns _Val.

Requirements

Header: <string>

Namespace: std

See Also

Reference

string (<string>)

wstring

<string>

Other Resources

<string> Members

basic_string Members