23#include "parse_exception.h" 
   34    template <
typename T> 
static T 
parse(
const std::string &input)
 
   36        std::istringstream iss(input);
 
   39        if constexpr (std::is_same_v<T, std::string>)
 
   47            if (iss.fail() || !iss.eof())
 
   49                throw TypeParseException(std::format(
"Failed to parse value of type {} from input: {}", 
typeid(T).name(), input), input, 
typeid(T));
 
 
   60    template <
typename T> 
static void parse(
const std::string &input, T &value)
 
   63        value = parse<T>(input);
 
 
 
Exception thrown when the input string cannot be parsed to the needed type for an argument.
Definition parse_exception.h:62
Helper struct providing static methods for parsing strings into various types.
Definition parser_utils.h:29
static T parse(const std::string &input)
Parses a string input into a value of type T.
Definition parser_utils.h:34
static void parse(const std::string &input, T &value)
Parses a string input into a value of type T.
Definition parser_utils.h:60