5.hpp 933 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef BOOST_METAPARSE_GETTING_STARTED_5_HPP
  2. #define BOOST_METAPARSE_GETTING_STARTED_5_HPP
  3. // Automatically generated header file
  4. // Definitions before section 4.2
  5. #include "4_2.hpp"
  6. // Definitions of section 4.2
  7. #include <boost/metaparse/transform.hpp>
  8. #include <boost/mpl/plus.hpp>
  9. #include <boost/mpl/at.hpp>
  10. template <class Vector>
  11. struct eval_plus :
  12. boost::mpl::plus<
  13. typename boost::mpl::at_c<Vector, 0>::type,
  14. typename boost::mpl::at_c<Vector, 2>::type
  15. > {};
  16. // query:
  17. // eval_plus<
  18. // boost::mpl::vector<
  19. // mpl_::integral_c<int, 11>,
  20. // mpl_::char_<'+'>,
  21. // mpl_::integral_c<int, 2>
  22. // >>::type
  23. #include <boost/mpl/quote.hpp>
  24. using exp_parser6 =
  25. build_parser<
  26. transform<
  27. sequence<int_token, plus_token, int_token>,
  28. boost::mpl::quote1<eval_plus>
  29. >
  30. >;
  31. // query:
  32. // exp_parser6::apply<BOOST_METAPARSE_STRING("11 + 2")>::type
  33. #endif