1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- [#get_message]
- [section get_message]
- [h1 Synopsis]
- template <class E>
- struct get_message;
- This is a [link lazy_metafunction lazy template metafunction].
- [table Arguments
- [[Name] [Type]]
- [[`E`] [[link reject reject] value]]
- ]
- [h1 Description]
- Returns the error message of a parsing failure.
- [h1 Header]
- #include <boost/metaparse/get_message.hpp>
- [h1 Example]
- #include <boost/metaparse/get_message.hpp>
- #include <boost/metaparse/start.hpp>
- #include <boost/metaparse/reject.hpp>
- #include <boost/metaparse/define_error.hpp>
-
- #include <type_traits>
-
- using namespace boost::metaparse;
-
- BOOST_METAPARSE_DEFINE_ERROR(sample_error, "Sample error message");
-
- struct returns_reject
- {
- using type = reject<sample_error, start>;
- };
-
- static_assert(
- std::is_same<
- sample_error,
- get_message<reject<sample_error, start>>::type
- >::type::value,
- "It should return the message"
- );
-
- static_assert(
- std::is_same<sample_error, get_message<returns_reject>::type>::type::value,
- "It should support lazy evaluation"
- );
- [endsect]
|