1[#get_message] 2[section get_message] 3 4[h1 Synopsis] 5 6 template <class E> 7 struct get_message; 8 9This is a [link lazy_metafunction lazy template metafunction]. 10 11[table Arguments 12 [[Name] [Type]] 13 [[`E`] [[link reject reject] value]] 14] 15 16[h1 Description] 17 18Returns the error message of a parsing failure. 19 20[h1 Header] 21 22 #include <boost/metaparse/get_message.hpp> 23 24[h1 Example] 25 26 #include <boost/metaparse/get_message.hpp> 27 #include <boost/metaparse/start.hpp> 28 #include <boost/metaparse/reject.hpp> 29 #include <boost/metaparse/define_error.hpp> 30 31 #include <type_traits> 32 33 using namespace boost::metaparse; 34 35 BOOST_METAPARSE_DEFINE_ERROR(sample_error, "Sample error message"); 36 37 struct returns_reject 38 { 39 using type = reject<sample_error, start>; 40 }; 41 42 static_assert( 43 std::is_same< 44 sample_error, 45 get_message<reject<sample_error, start>>::type 46 >::type::value, 47 "It should return the message" 48 ); 49 50 static_assert( 51 std::is_same<sample_error, get_message<returns_reject>::type>::type::value, 52 "It should support lazy evaluation" 53 ); 54 55[endsect] 56 57