get_remaining.qbk 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. [#get_remaining]
  2. [section get_remaining]
  3. [h1 Synopsis]
  4. template <class D>
  5. struct get_remaining;
  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 remaining string information of a parsing result.
  13. [h1 Header]
  14. #include <boost/metaparse/get_remaining.hpp>
  15. [h1 Example]
  16. #include <boost/metaparse/get_remaining.hpp>
  17. #include <boost/metaparse/start.hpp>
  18. #include <boost/metaparse/accept.hpp>
  19. #include <boost/metaparse/string.hpp>
  20. #include <type_traits>
  21. using namespace boost::metaparse;
  22. struct returns_accept
  23. {
  24. using type =
  25. accept<
  26. std::integral_constant<int, 13>,
  27. BOOST_METAPARSE_STRING("foo"),
  28. start
  29. >;
  30. };
  31. static_assert(
  32. std::is_same<
  33. BOOST_METAPARSE_STRING("foo"),
  34. get_remaining<
  35. accept<
  36. std::integral_constant<int, 13>,
  37. BOOST_METAPARSE_STRING("foo"),
  38. start
  39. >
  40. >::type
  41. >::type::value,
  42. "It should return the remaining input"
  43. );
  44. static_assert(
  45. std::is_same<
  46. BOOST_METAPARSE_STRING("foo"),
  47. get_remaining<returns_accept>::type
  48. >::type::value,
  49. "It should support lazy evaluation"
  50. );
  51. [endsect]