<boost/url/grammar/optional_rule.hpp>
template<Rule R>
constexpr
/* implementation-defined */
optional_rule(R const& r);
Optional BNF elements are denoted with square brackets. If the specified rule returns any error it is treated as if the rule did not match.
using value_type = optional< typename Rule::value_type >;
Rules are used with the function grammar::parse
.
system::result< optional< core::string_view > > rv = parse( "", optional_rule( token_rule( alpha_chars ) ) );
optional = [ rule ]
Name | Description |
---|---|
r | The rule to match |