[#get_prev_char]
[section get_prev_char]

[h1 Synopsis]

  template <class SourcePosition>
  struct get_prev_char;

This is a [link lazy_metafunction lazy template metafunction].

[table Arguments
  [[Name]             [Type]]
  [[`SourcePosition`] [[link source_position source position]]]
]

[h1 Description]

Returns the last character the source position was updated with. The value it
returns for [link start `start`] is unspecified.

[h1 Header]

  #include <boost/metaparse/get_prev_char.hpp>

[h1 Expression semantics]

For any `l`, `c` compile-time wrapped integral values and `ch` compile-time
wrapped character the following are equivalent

  get_prev_char<source_position<l, c, ch>>::type
  
  ch::type

[h1 Example]

  #include <boost/metaparse/get_prev_char.hpp>
  #include <boost/metaparse/source_position.hpp>
  
  #include <type_traits>
  
  using namespace boost::metaparse;
  
  struct returns_source_position
  {
    using type =
      source_position<
        std::integral_constant<int, 11>,
        std::integral_constant<int, 13>,
        std::integral_constant<char, 'x'>
      >;
  };
  
  static_assert(
    get_prev_char<
      source_position<
        std::integral_constant<int, 11>,
        std::integral_constant<int, 13>,
        std::integral_constant<char, 'x'>
      >
    >::type::value == 'x',
    "It should return the prev. char of a source position"
  );
  
  static_assert(
    get_prev_char<returns_source_position>::type::value == 'x',
    "It should support lazy evaluation"
  );

[endsect]

