Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

get_result

Synopsis

template <class D>
struct get_result;

This is a lazy template metafunction.

Table 37. Arguments

Name

Type

D

accept value


Description

Returns the result information of a parsing result.

Header

#include <boost/metaparse/get_result.hpp>

Example

#include <boost/metaparse/get_result.hpp>
#include <boost/metaparse/start.hpp>
#include <boost/metaparse/accept.hpp>
#include <boost/metaparse/string.hpp>

using namespace boost::metaparse;

struct returns_accept
{
  using type =
    accept<
      std::integral_constant<int, 13>,
      BOOST_METAPARSE_STRING("foo"),
      start
    >;
};

static_assert(
  get_result<
    accept<
      std::integral_constant<int, 13>,
      BOOST_METAPARSE_STRING("foo"),
      start
    >
  >::type::value == 13,
  "It should return the result of parsing"
);

static_assert(
  get_result<returns_accept>::type::value == 13,
  "It should support lazy evaluation"
);

PrevUpHomeNext