2 [section get_prev_char]
6 template <class SourcePosition>
9 This is a [link lazy_metafunction lazy template metafunction].
13 [[`SourcePosition`] [[link source_position source position]]]
18 Returns the last character the source position was updated with. The value it
19 returns for [link start `start`] is unspecified.
23 #include <boost/metaparse/get_prev_char.hpp>
25 [h1 Expression semantics]
27 For any `l`, `c` compile-time wrapped integral values and `ch` compile-time
28 wrapped character the following are equivalent
30 get_prev_char<source_position<l, c, ch>>::type
36 #include <boost/metaparse/get_prev_char.hpp>
37 #include <boost/metaparse/source_position.hpp>
39 #include <type_traits>
41 using namespace boost::metaparse;
43 struct returns_source_position
47 std::integral_constant<int, 11>,
48 std::integral_constant<int, 13>,
49 std::integral_constant<char, 'x'>
56 std::integral_constant<int, 11>,
57 std::integral_constant<int, 13>,
58 std::integral_constant<char, 'x'>
60 >::type::value == 'x',
61 "It should return the prev. char of a source position"
65 get_prev_char<returns_source_position>::type::value == 'x',
66 "It should support lazy evaluation"