代码之家  ›  专栏  ›  技术社区  ›  niXman

错误:助推。聚变:for_each()和派生自的结构boost.tuple文件

  •  1
  • niXman  · 技术社区  · 14 年前

    在编写本规范时:

    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文件.

    1 回复  |  直到 13 年前
        1
  •  1
  •   Anthony Pegram    13 年前

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