作者sportsben (sportsben)
看板EE_DSnP
標題[問題] Hash<StrashKey,CirGate>的宣告
時間Mon Jan 16 19:18:19 2012
我是用老師的code
如果我是這樣宣告
Hash<StrashKey,CirGate> compile說CirGate是virtual class所以不行
可是我宣告成Hash<StrashKey,CirAigGate>
但是我的就不能傳CirGate的東西進去了>< 像是 _dfsList[i] 或是 _totGateList[i]
傳進去都說有error
請問有其他的方法嗎?QQ
先感謝回答的人QQ
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.247.93
1F:→ e124553423:用pointer 01/16 19:19
抱歉我還是不懂耶><
像是我有一行code是
myStrash.insert( StrashKey(*_dfsList[i]), *_dfsList[i] );
compile>>
ig.cpp: In member function 「void CirMgr::strash()」:cirFraig.cpp:41:66: 錯誤
: 從類型 「CirGate*」 到類型 「CirAigGate*」 的轉換無效
[-fpermissive]cirFraig.cpp:44:66: 錯誤: 對 「Hash<StrashKey,
CirAigGate>::insert(StrashKey, CirGate&)」 的呼叫沒有匹配的函式
candidate is:
../../include/myHash.h:116:9: ?钦酉嚗?bool Hash<HashKey,
HashData>::insert(const HashKey&, const HashData*) [with HashKey = StrashKey,
HashData = CirAigGate]
※ 編輯: sportsben 來自: 140.112.247.93 (01/16 19:27)
2F:→ djshen:用copy的會花很多記憶體吧.. 01/16 19:25
※ 編輯: sportsben 來自: 140.112.247.93 (01/16 19:34)
3F:→ djshen:myStrash改成<StrashKey,CirGate*>? 01/16 19:34
4F:→ djshen:宣告的地方沒改吧? 01/16 19:35
5F:→ sportsben:真的很謝謝樓上 我依照樓上的宣告方法 compile有過>< 01/16 19:43
6F:→ sportsben:myStrash.insert( StrashKey(*_dfsList[i]), _dfsList[] 01/16 19:44