在编写本规范时:
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()); }
获取错误:“struct any\u type”中没有名为“category”的类型 我希望它继承自boost.tuple文件.
继承自 boost::fusion::tuple 而不是 boost::tuple . 考虑制作 void operator()(const std::string& v) 常数
boost::fusion::tuple
boost::tuple
void operator()(const std::string& v)