Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

get_remaining

Synopsis

template <class D>
struct get_remaining;

This is a lazy template metafunction.

Table 36. Arguments

Name

Type

D

accept value


Description

Returns the remaining string information of a parsing result.

Header

#include <boost/metaparse/get_remaining.hpp>

Example

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

#include <type_traits>

using namespace boost::metaparse;

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

static_assert(
  std::is_same<
    BOOST_METAPARSE_STRING("foo"),
    get_remaining<
      accept<
        std::integral_constant<int, 13>,
        BOOST_METAPARSE_STRING("foo"),
        start
      >
    >::type
  >::type::value,
  "It should return the remaining input"
);

static_assert(
  std::is_same<
    BOOST_METAPARSE_STRING("foo"),
    get_remaining<returns_accept>::type
  >::type::value,
  "It should support lazy evaluation"
);

PrevUpHomeNext