[#keyword]
[section keyword]
[h1 Synopsis]
template
struct keyword;
This is a [link parser parser].
[table Arguments
[[Name] [Type]]
[[`S`] [[link string string]]]
[[`ResultType`] [[link metaprogramming_value template metaprogramming value]]]
]
[h1 Description]
Parser accepting the keyword `S`. The result of parsing is `ResultType`, which
is optional; when not given, the result of successful parsing is undefined.
[h1 Header]
#include
[h1 Expression semantics]
For any `r` class and `s` compile-time string that is built from the characters
`c1` ... `cn` the following are equivalent:
keyword
last_of, /* ... */, lit, return_>
[h1 Example]
#include
#include
#include
#include
#include
#include
using namespace boost::metaparse;
static_assert(
get_result<
keyword>
::apply
>::type::value == 13,
"the result of parsing the keyword is keyword's second argument"
);
static_assert(
is_error<
keyword>
::apply
>::type::value,
"a word other than the keyword is an error"
);
[endsect]