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