错误:boost.fusion ::的for_each()和struct从boost.tuple衍生
-
26-09-2019 - |
题
在编译的代码:
struct any_type: boost::tuple<std::string, std::string, std::string> {
...
};
struct functor {
void operator()(const std::string& v) {
std::cout << v << std::endl;
}
};
int main() {
any_type type;
boost::fusion::for_each(type, functor());
}
得到误差:无类型命名为“类别”在“结构any_type” 为什么? 我希望它从boost.tuple继承。
解决方案
继承boost::fusion::tuple
代替boost::tuple
。结果
注意:强>考虑使void operator()(const std::string& v)
常量
不隶属于 StackOverflow