我需要帮助。尝试迭代集合时出现以下错误:
错误 1 错误 C2440:“正在初始化”:无法从“std::_Tree_const_iterator<_Mytree>”转换为“compound_objectNS::Compound_object *”c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory 208
我得到以下代码:从文件“compound_object.cpp”中提取:
typedef compound_objectNS::Compound_object OBJECT
bool OBJECT::operator== (const Compound_object &object) const
{
return this == &object;
}
bool OBJECT::operator< (const Compound_object &object) const
{
return this->m_numberOfObject < object.m_numberOfObject;
}
在这里允许设置对元素进行排序,我覆盖了运算符“==”和“<”
客户端文件:
for (objectImitatorNS::set<compound_objectNS::Compound_object*>::iterator it = Objects->begin();
it != Objects->end(); ++it)
{
this->m_imitatedObjects->insert(it);
}
当我发现行时会引发错误
this->m_imitatedObjects->插入(它)
执行。
如何解决这个问题?