如标题。尝试进行 dynamic_cast 时出现此错误
不能 dynamic_cast '(& obj)->std::reference_wrapper<_Tp>::get()' (类型为 'class MEPObject')输入 'class MEPGene&' (目标不是完整类型的指针或引用)genes.push_back (dynamic_cast (obj.get()));
class MEPObject;
class MEPGene;
typedef std::vector<std::reference_wrapper<MEPObject>> MEPObjects;
typedef std::vector<std::reference_wrapper<MEPGene>> MEPGenes;
void dynamicCast(MEPObjects &objects, MEPGenes &genes)
{
for(const auto &obj: objects)
{
genes.push_back(dynamic_cast<MEPGene&> (obj.get()));
}
}