[#lit_c]
[section lit_c]

[h1 Synopsis]

  template <char C>
  struct lit;

This is a [link parser parser].

[table Arguments
  [[Name] [Type]]
  [[`C`]  [`char` value]]
]

[h1 Description]

Parser accepting only the `C` character. The result of parsing is the accepted
character.

[h1 Header]

  #include <boost/metaparse/lit_c.hpp>

[h1 Expression semantics]

For any `c` character the following are equivalent:

  lit_c<c>
  
  lit<boost::mpl::char_<c>>

[h1 Example]

  #include <boost/metaparse/lit_c.hpp>
  #include <boost/metaparse/start.hpp>
  #include <boost/metaparse/string.hpp>
  #include <boost/metaparse/is_error.hpp>
  #include <boost/metaparse/get_result.hpp>
  
  using namespace boost::metaparse;
  
  static_assert(
    is_error<lit_c<'x'>::apply<BOOST_METAPARSE_STRING("a"), start>>::type::value,
    "a different character should be an error"
  );
  
  static_assert(
    is_error<lit_c<'x'>::apply<BOOST_METAPARSE_STRING(""), start>>::type::value,
    "empty input should be an error"
  );
  
  static_assert(
    get_result<
      lit_c<'x'>::apply<BOOST_METAPARSE_STRING("x"), start>
    >::type::value == 'x',
    "result of parsing should be the accepted character"
  );

[endsect]

