The result of a parse operation.
<mrdocs/Support/Parse.hpp>
struct ParseResult;
| Name | Description |
|---|---|
operator bool | Conversion to bool |
| Name |
|---|
ec |
ptr |
| Name | Description |
|---|---|
operator== |
Equality operator |
| Name | Description |
|---|---|
parse | Parse a string view |
This class holds the result of a parse operation. The structure is similar to std::from_chars_result, where we have a ptr member that points to the first character not parsed, and a ec member that holds the error code.
If parsing was successful, then ec stores a default constructed Error object, which indicates success. The operator bool can also be used to check for success.
The typical format of a parsing function is:
ParseResult
parseType(
char const* first,
char const* last,
Type& value);
where more parameters can be defined as needed for parsing options.