61 lines
1.1 KiB
Plaintext
61 lines
1.1 KiB
Plaintext
|
[#get_result]
|
||
|
[section get_result]
|
||
|
|
||
|
[h1 Synopsis]
|
||
|
|
||
|
template <class D>
|
||
|
struct get_result;
|
||
|
|
||
|
This is a [link lazy_metafunction lazy template metafunction].
|
||
|
|
||
|
[table Arguments
|
||
|
[[Name] [Type]]
|
||
|
[[`D`] [[link accept accept] value]]
|
||
|
]
|
||
|
|
||
|
[h1 Description]
|
||
|
|
||
|
Returns the result information of a parsing result.
|
||
|
|
||
|
[h1 Header]
|
||
|
|
||
|
#include <boost/metaparse/get_result.hpp>
|
||
|
|
||
|
[h1 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"
|
||
|
);
|
||
|
|
||
|
[endsect]
|
||
|
|