[#fail_at_first_char_expected] [section fail_at_first_char_expected] [h1 Synopsis] template struct fail_at_first_char_expected; This is a [link parser_combinator parser combinator]. [table Arguments [[Name] [Type]] [[`P`] [[link parser parser]]] ] [h1 Description] It tries to parse the input using `P`. When `P` rejects the input without consuming any character, `fail_at_first_char_expected` accepts the input. Otherwise (when `P` accepts the input or when it consumes characters before rejecting the input) `fail_at_first_char_expected` rejects the input. [h1 Header] #include [h1 Expression semantics] For any `p` parser, `s` compile-time string and `pos` source position: When `is_error>::type` is false, the following are equivalent: fail_at_first_char_expected

::apply::type reject When `is_error>::type` is true and `boost::mpl::equal_to>::type>::type` is also true, the following are equivalent: get_remaining, s, pos>::type accept Otherwise the following are equivalent: get_remaining, s, pos>::type p::apply::type [h1 Example] #include #include #include #include #include #include #include #include #include #include #include #include using namespace boost::metaparse; using plus_int = last_of, int_>; using plus_exp = first_of< foldl_start_with_parser< plus_int, int_, boost::mpl::lambda>::type >, fail_at_first_char_expected >; static_assert( get_result< plus_exp::apply >::type::value == 6, "it should accept the input when it is a list of '+' separated ints" ); static_assert( is_error< plus_exp::apply >::type::value, "it should reject the input when it has an extra +" ); [endsect]