创建一个凤凰函数用于灵魂统治
Create a phoenix function for use in spirit rule
我试图使下面的代码编译,但是,像往常一样,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() ];
}
正如ildjarn所说,调用foo会遗漏一个参数。
相关文章:
- boost::bind()类似的东西,但用于函数调用
- 为什么通用参考概念不适用于函数指针的地图插入
- 为什么保守调整大小不适用于函数中的 Ref 变量?
- 用于C++函数的自动 C 包装器
- 函数指针类型不能用于函数原型
- 如何将"using"用于函数?
- 指针或局部变量,用于函数的输出参数
- C 类模板扣除(P0091R0)用于函数参数
- 用于函数签名的专用模板
- 为什么关键字“显式”不适用于函数参数
- 预期的"("用于函数式铸造或类型构造
- 将模板用于函数时出错
- 部分模板专用化可能不适用于函数,但重载不是一回事吗?
- if 语句不适用于函数
- 将数组用于函数输入参数
- 如何确定哪个 Windows DLL 用于函数调用
- 转换运算符不适用于函数参数
- 为什么参数相关查找不适用于函数模板dynamic_pointer_cast
- 用于函数样式强制转换或类型构造的预期 c++ Xcode '('
- c++14用于函数绑定的可变lambda捕获