As ildjarn said, call to foo misses an argument.
Create a phoenix function for use in spirit rule
-
18-03-2022 - |
Question
I'm trying to make the code below compile, but, as usual, errors with spirit/phoenix gives not a lot a clues about what is wrong. Can anyone see what the problem is ?
#include <boost/spirit/include/phoenix.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/shared_ptr.hpp>
typedef boost::shared_ptr<int> sptr;
struct bar
{
template <typename A> struct result
{
typedef sptr type;
};
template <typename A> sptr operator()(A) const
{
return sptr();
}
};
boost::phoenix::function<bar> foo;
void test()
{
namespace qi = boost::spirit::qi;
using qi::_val;
qi::rule
<
std::string::const_iterator,
sptr(),
boost::spirit::ascii::space_type
>
test_rule = qi::eps [ _val = foo() ];
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow