Pergunta

Na compilação deste código:

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

Obtenha erro: nenhum tipo nomeado 'categoria' em 'struct any_type' por quê? Eu quero que ele herde de boost.tuple.

Foi útil?

Solução

Herdar de boost::fusion::tuple ao invés de boost::tuple.
Observação: Considere fazer void operator()(const std::string& v) const

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top