9 This is a [link lazy_metafunction lazy template metafunction].
13 [[`D`] [[link accept accept] or [link reject reject] value]]
18 Returns the source position information of a parsing result.
22 #include <boost/metaparse/get_position.hpp>
26 #include <boost/metaparse/get_position.hpp>
27 #include <boost/metaparse/start.hpp>
28 #include <boost/metaparse/accept.hpp>
29 #include <boost/metaparse/reject.hpp>
30 #include <boost/metaparse/string.hpp>
31 #include <boost/metaparse/define_error.hpp>
33 #include <type_traits>
35 using namespace boost::metaparse;
37 BOOST_METAPARSE_DEFINE_ERROR(sample_error, "Sample error message");
41 using type = reject<sample_error, start>;
47 get_position<reject<sample_error, start>>::type
49 "It should return the position of a reject"
56 accept<sample_error, BOOST_METAPARSE_STRING("foo"), start>
59 "It should return the position of an accept"
63 std::is_same<start, get_position<returns_reject>::type>::type::value,
64 "It should support lazy evaluation"