作者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