我正在尝试编译下面的代码,但是,像往常一样,spirit/phoenix 的错误并没有提供很多关于什么是错误的线索。谁能看到问题是什么?
#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() ];
}