[#repeated] [section repeated] [h1 Synopsis] template struct repeated; This is a [link parser_combinator parser combinator]. [table Arguments [[Name] [Type]] [[`P`] [[link parser parser]]] ] [h1 Description] It applies `P` on the input string repeatedly as long as `P` accepts the input. The result of parsing is a sequence of the results of the individual applications of `P`. When `P` rejects the input for the first time, `repeated` still accepts the input and the result of parsing is an empty sequence. Here is a diagram showing how `repeated` works by example: using int_token = token; [$images/metaparse/repeated_diag1.png [width 70%]] Further details can be found in the [link repetition Repetition] section of the [link manual User Manual]. [h1 Header] #include [h1 Expression semantics] For any `p` parser the following are equivalent: repeated

foldl< p, /* unspecified empty sequence */, boost::mpl::push_back<_2, _1> > [h1 Example] #include #include #include #include #include #include #include #include using namespace boost::metaparse; using digits = repeated; static_assert( boost::mpl::equal< get_result>::type, boost::mpl::vector< boost::mpl::int_<1>, boost::mpl::int_<2>, boost::mpl::int_<3>, boost::mpl::int_<4> > >::type::value, "the result of parsing should be the list of digit values" ); static_assert( boost::mpl::equal< get_result>::type, boost::mpl::vector<> >::type::value, "repeated should accept the input when it can't parse anything with digit_val" ); [endsect]