[#one_char] [section one_char] [h1 Synopsis] struct one_char; This is a [link parser parser]. [h1 Description] `one_char` accepts one character. The result of parsing is the accepted character. It fails for empty input. [h1 Header] #include [h1 Expression semantics] For any `s` non-empty compile-time string and `pos` source position the following are equivalent get_result> boost::mpl::front get_remaining> boost::mpl::pop_front The value of `get_position>` depends on the first character of the sequence and the value of the one parsed before that (which is stored in the source position). `one_char` updates the source position's `col` and `line` values based on the new line characters. It detects Linux (`\n`), Windows (`\r\n`) and Mac (`\r`) line endings. `one_char::apply` returns an error for every `pos` source position. [h1 Example] #include #include #include #include #include #include #include using namespace boost::metaparse; static_assert( get_result< one_char::apply >::type::value == 'f', "the result of parsing should be the first character of the input" ); static_assert( std::is_same< BOOST_METAPARSE_STRING("oo"), get_remaining>::type >::type::value, "one_char should consume the first character of the input" ); static_assert( is_error>::type::value, "it should return an error for empty input" ); [endsect]