get_result.qbk 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. [#get_result]
  2. [section get_result]
  3. [h1 Synopsis]
  4. template <class D>
  5. struct get_result;
  6. This is a [link lazy_metafunction lazy template metafunction].
  7. [table Arguments
  8. [[Name] [Type]]
  9. [[`D`] [[link accept accept] value]]
  10. ]
  11. [h1 Description]
  12. Returns the result information of a parsing result.
  13. [h1 Header]
  14. #include <boost/metaparse/get_result.hpp>
  15. [h1 Example]
  16. #include <boost/metaparse/get_result.hpp>
  17. #include <boost/metaparse/start.hpp>
  18. #include <boost/metaparse/accept.hpp>
  19. #include <boost/metaparse/string.hpp>
  20. using namespace boost::metaparse;
  21. struct returns_accept
  22. {
  23. using type =
  24. accept<
  25. std::integral_constant<int, 13>,
  26. BOOST_METAPARSE_STRING("foo"),
  27. start
  28. >;
  29. };
  30. static_assert(
  31. get_result<
  32. accept<
  33. std::integral_constant<int, 13>,
  34. BOOST_METAPARSE_STRING("foo"),
  35. start
  36. >
  37. >::type::value == 13,
  38. "It should return the result of parsing"
  39. );
  40. static_assert(
  41. get_result<returns_accept>::type::value == 13,
  42. "It should support lazy evaluation"
  43. );
  44. [endsect]