我在C++ STL容器映射中遇到了一個問題。關於STL容器
class c1 {
map<int , vector<entity>> mapobject //where entity is a structure
c1{
entity er;
er.entityId = 1;
er.nameId = 1;
std::vector<entity> record;
record.push_back(er);
mapobject.insert(std::pair<int,std::vector<entity>>(1,record));
}
}
其中我是從上面的代碼中面臨的問題是,構造外,所有的晶格結構域中包含無用值。請問班級變量 - 地圖不能深層複製內容?
請幫我在這
--kumar
你的代碼是非常不正確的。什麼是c1,你的函數在哪裏,爲什麼地圖聲明是一個字符串? – 2012-04-23 07:10:46
'entity'看起來像什麼? – 2012-04-23 07:20:09
除了上面的廣泛的語法錯誤選擇,你是否確定這些字段包含垃圾?你不只是試圖調試發佈模式的構建,是嗎? – RobH 2012-04-23 07:22:17