mrdocs::parse
Parse a string view
Synopsis
Declared in <mrdocs/Support/Parse.hpp>
template<HasParse T>
ParseResult
parse(
std::string_view sv,
T& value);
Description
This function parses a string view sv into a value of type T. The function calls the parse function for the type T with the sv.data() and sv.data() + sv.size() as the first and last pointers, respectively.
If the parse function returns an error, then the function returns the error.
If the parse function returns success, but there are characters left in the string view, then the function returns an error with the message "trailing characters".
Otherwise, it returns the value.
Parameters
| Name | Description |
|---|---|
sv |
The string view to parse |
value |
The value to store the result |
Created with MrDocs