struct Vision3PosInfo { bool bAllLineFind; double dRotateAngle; dLine lines[12]; CString sNumber; Vision3PosInfo() { bAllLineFind = false; } }; std::vector<Vision3PosInfo> m_Vision3PosInfoVec; for (vector<Vision3PosInfo >::iterator it = m_Vision3PosInfoVec.begin(); it != m_Vision3PosInfoVec.end(); ++it) { if (sNumber == (it)->sNumber) { vision3Pos = *it; //使用用直接赋值即可 //memcpy(&vision3Pos, &(*it), sizeof(Vision3PosInfo)); //不能用memcpy,当成员有CString,string,会发生不可预知错误。因数据大小不可预知。 m_Vision3PosInfoVec.erase(it); bfind = true; break; } }