문제

on compilation this code:

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());
}

get error: no type named 'category' in 'struct any_type' why? I want it to inherit from boost.tuple.

도움이 되었습니까?

해결책

Inherit from boost::fusion::tuple instead of boost::tuple.
Note: Consider making void operator()(const std::string& v) const

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top