[#transform] [section transform] [h1 Synopsis] template struct transform; This is a [link parser_combinator parser combinator]. [table Arguments [[Name] [Type]] [[`P`] [[link parser parser]]] [[`T`] [[link metafunction_class template metafunction class] taking one argument]] ] [h1 Description] `transform` parses the input using `P` and transforms the result `P` returns with `T`. The result of parsing is what `T` returns. When `P` fails, the failure is returned unchanged. [h1 Header] #include [h1 Expression semantics] For any `p` parser, `t` metafunction class accepting one argument, `s` compile-time string and `pos` source position get_result::apply>::type is equivalent to t::apply>::type>::type When `p::apply` doesn't return an error. The combinator returns the error otherwise. [h1 Example] #include #include #include #include #include #include #include using namespace boost::metaparse; using digit_value = transform>; static_assert( !is_error< digit_value::apply >::type::value, "digit_val should accept a digit" ); static_assert( is_error>::type::value, "digit_val should reject a character" ); static_assert( get_result< digit_value::apply >::type::value == 0, "the result of parsing should be the int value" ); [endsect]