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