[#nth_of] [section nth_of] [h1 Synopsis] template struct nth_of; This is a [link parser_combinator parser combinator]. [table Arguments [[Name] [Type]] [[`N`] [[link boxed_value boxed] integer value in the range `[0..sizeof...(Ps)]`]] [[`Ps`] [[link parser parser]s]] ] [h1 Description] `nth_of` applies the `Ps...` parsers in sequence. It accepts an input when all of these parsers accept it. The result of parsing is the result of the `N`. parser. On compilers, which are not C++11-compliant, the maximum number of parsers `nth_of` accepts can be specified with the `BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE` macro. Its default value is `5`. [h1 Header] #include [h1 Expression semantics] For any `p0`, ..., `pn` parsers and `k` boxed integer value the following are equivalent nth_of nth_of_c [h1 Example] #include #include #include #include #include #include #include #include #include using namespace boost::metaparse; using int_token = token; using left_paren_token = token>; using right_paren_token = token>; using int_in_parens = nth_of< std::integral_constant, left_paren_token, int_token, right_paren_token >; static_assert( get_result< int_in_parens::apply >::type::value == 13, "it should return the result of the second parser" ); static_assert( is_error< int_in_parens::apply >::type::value, "it should reject the input when there are no parens" ); static_assert( is_error< int_in_parens::apply >::type::value, "it should reject the input when there is no closing paren" ); [endsect]