[#foldl1] [section foldl1] [h1 Synopsis] template struct foldl1; This is a [link parser_combinator parser combinator]. [table Arguments [[Name] [Type]] [[`P`] [[link parser parser]]] [[`State`] [[link metaprogramming_value template metaprogramming value]]] [[`ForwardOp`] [[link metafunction_class template metafunction class] taking two arguments]] ] [h1 Description] `foldl1` applies `P` on the input string repeatedly as long as `P` accepts the input. The result of parsing is equivalent to `boost::mpl::fold`, where `Sequence` is the sequence of the results of the applications of `P`. When `P` rejects the input for the first time, `foldl1` rejects it as well. At least one successful application of `P` is required for `foldl1` to accept the input. [h1 Header] #include [h1 Expression semantics] For any `p` parser, `t` class, `f` metafunction class taking two arguments the following are equivalent: foldl1 last_of, foldl> [h1 Example] #include #include #include #include #include #include #include #include #include using namespace boost::metaparse; using int_token = token; using sum_op = boost::mpl::lambda>::type; using ints = foldl1, sum_op>; static_assert( get_result< ints::apply >::type::value == 48, "ints should sum the numbers" ); static_assert( is_error>::type::value, "when no numbers are provided, it should be an error" ); [endsect]