1

在编译此代码时:

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_type”中没有名为“category”的类型,为什么?我希望它继承自 boost.tuple。

4

1 回答 1

1

继承自boost::fusion::tuple而不是boost::tuple.
注意:考虑制作void operator()(const std::string& v)const

于 2010-09-29T20:11:47.340 回答