Ookii.CommandLine for C++
2.0.0
|
Template class used to convert strings to strongly typed argument values. More...
#include <ookii/string_helper.h>
Static Public Member Functions | |
static std::optional< T > | from_string (std::basic_string_view< CharType, Traits > value, const std::locale &loc={}) |
Convert a string to the specified type. More... | |
Template class used to convert strings to strongly typed argument values.
This base template uses a stringstream to do the conversion, relying on stream extraction operator>>
for the provided type. The template can be specialized to provide conversion of custom types.
T | The type to convert to. |
CharType | The character type used. |
Traits | The character traits to use. Defaults to std::char_traits<CharType> . |
Alloc | The allocator to use. Defaults to std::allocator<CharType> . |
|
inlinestatic |
Convert a string to the specified type.
value | The string value to convert. |
loc | The locale to use for conversion. |
std::nullopt
if conversion failed.