A set of templates providing an interface to convert an argument specifying a C or C++ string to a value of a specified type. This template is available (i.e. participates in overload resolution) when the type is integral. .
- Template Parameters
-
| T | is a type for the string value to convert to. The type T must be either constructible from strValue directly or be one of the fundamental arithmetic types. Particularly this overload is chosen when T is integral. |
| CharT | A deduced type of a character of the string. It must be either char or wchar_t. |
| TraitsT | A deduced traits type used by the string. |
| AllocT | A deduced allocator type used by the string. |
- Parameters
-
| strValue | A C++ string containing the value to convert. |
| base | A base in which the integral numeric value is expected in strValue. |
- Returns
- The resulting value. The function redirects the call to to overloads of
from_string accepting char or wchar_t based C-strings.
If the function is called with one argument and non-integral T, the other version of from_string will be chosen using SFINAE.
- Note
- Unlike C and C++ library conversion functions, this function fails, if
strValue is an empty string, or if not the entire strValue can be converted into the type T, because of parsing errors and when the produced value goes out of valid range of supported values for T.
- Exceptions
-