9 This is a [link parser parser].
13 [[`C`] [[link metaprogramming_value template metaprogramming value]]]
18 `return_` accepts every input. The result of parsing is `C`, the remaining
19 string is the input string.
23 #include <boost/metaparse/return_.hpp>
25 [h1 Expression semantics]
27 For any `c` class, `s` compile-time string and `pos` source position the
28 following are equivalent
30 get_result<return_<c>::apply<s, pos>>::type
34 get_remaining<return_<c>::apply<s, pos>>::type
38 get_position<return_<c>::apply<s, pos>>::type
44 #include <boost/metaparse/return_.hpp>
45 #include <boost/metaparse/int_.hpp>
46 #include <boost/metaparse/one_of.hpp>
47 #include <boost/metaparse/start.hpp>
48 #include <boost/metaparse/string.hpp>
49 #include <boost/metaparse/get_result.hpp>
51 #include <type_traits>
53 using namespace boost::metaparse;
55 using default_value = std::integral_constant<int, 13>;
57 using optional_number = one_of<int_, return_<default_value>>;
61 optional_number::apply<BOOST_METAPARSE_STRING("11"), start>
63 "when a number is provided, it is the result of parsing"
68 optional_number::apply<BOOST_METAPARSE_STRING(""), start>
70 "when no number is provided, the default value is the result of parsing"