Home | Libraries | People | FAQ | More |
template <class P> struct build_parser;
This is a template metafunction.
It generates a simple interface for parser. It returns a metafunction class
that takes an input string, parses it with P
and returns the result of parsing. It generates a compilation error when
parsing fails.
It returns a template metafunction class:
struct { template <class S> struct apply; };
#include <boost/metaparse/build_parser.hpp>
For any p
parser and s
compile-time string
build_parser<p>::type::apply<s>
is equivalent to
get_result<p::apply<s>>
#include <boost/metaparse/build_parser.hpp> #include <boost/metaparse/int_.hpp> #include <boost/metaparse/string.hpp> using namespace boost::metaparse; using string_to_int = build_parser<int_>::type; static_assert( string_to_int::apply<BOOST_METAPARSE_STRING("1113")>::type::value == 1113, "string_to_int should be a metafunction turning a string into an int" );