[#iterate_c] [section iterate_c] [h1 Synopsis] template struct iterate_c; This is a [link parser_combinator parser combinator]. [table Arguments [[Name] [Type]] [[`P`] [[link parser parser]]] [[`N`] [non-negative integer value]] ] [h1 Description] It applies `P` on the input string `N` times. The result of parsing is a sequence of the results of the individual applications of `P`. `P` has to accept the input `N` times for `iterate_c` to accept it. [h1 Header] #include [h1 Expression semantics] For any `p` parser, `n` integer value the following are equivalent: iterate_c sequence< p, // 1. p, // 2. // ... p // n. > [h1 Example] #include #include #include #include #include #include #include #include #include using namespace boost::metaparse; static_assert( boost::mpl::equal< boost::mpl::vector< boost::mpl::char_<'1'>, boost::mpl::char_<'2'>, boost::mpl::char_<'3'> >, get_result< iterate_c::apply >::type >::type::value, "the result should be the sequence of the individual applications of digit" ); static_assert( boost::mpl::equal< boost::mpl::vector< boost::mpl::char_<'1'>, boost::mpl::char_<'2'>, boost::mpl::char_<'3'> >, get_result< iterate_c::apply >::type >::type::value, "only three iterations should be made" ); static_assert( is_error< iterate_c::apply >::type::value, "it should fail when digit can not be applied three times" ); [endsect]