metaparse/doc/get_message.qbk
2015-07-19 09:53:35 +02:00

57 lines
1.1 KiB
Plaintext

[#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]