[#look_ahead] [section look_ahead] [h1 Synopsis] template struct look_ahead; This is a [link parser_combinator parser combinator]. [table Arguments [[Name] [Type]] [[`P`] [[link parser parser]]] ] [h1 Description] Parses the input using parser `P`. When `P` returns an error, `look_ahead` returns the error. When `P` returns a result, `look_ahead` returns the result without consuming anything from the input string. [h1 Header] #include [h1 Expression semantics] For any `p` parser, `s` compile-time string and `pos` source position look_ahead

::apply is equivalent to return_>::type>::apply when `p::apply` succeeds. It is p::apply otherwise. [h1 Example] #include #include #include #include #include #include #include #include using namespace boost::metaparse; static_assert( get_result< look_ahead::apply >::type::value == 13, "it should return the same result as the wrapped parser" ); static_assert( std::is_same< BOOST_METAPARSE_STRING("13"), get_remaining< look_ahead::apply >::type >::type::value, "it should not consume any input" ); static_assert( is_error< look_ahead::apply >::type::value, "it should fail when the wrapped parser fails" ); [endsect]