看板 EE_DSnP 關於我們 聯絡資訊
// return true if inserted successfully (i.e. k is not in the hash) // return false is k is already in the hash ==> still do the insertion bool replaceInsert(const HashKey& k, const HashData& d); 這個 function 是用在你一定想要把 HashNode(k, d) insert 進去, 不管原來 Hash 裡面是否已經含有 "HashKey k" 的 entry。 如果原來沒有,就 return true; 但如果原來有,不管原來對應的 HashData 是不是等於 d, 都 return false, 表示舊的有被更新到。 // Need to be sure that k is not in the hash void forceInsert(const HashKey& k, const HashData& d); 這個 function 的呼叫是當你已經確定 Hash 裡面沒有 "HashKey k" 這個 entry, (也就是說剛剛已經檢查過了) 所以就不再檢查,而直接把 HashNode(k, d) 直接 insert 進去。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 111.248.110.117
yan12125:推! 12/25 01:10
vegired:推! 12/25 01:38
XDucka:所以replaceinsert是要拿新的d更新舊的d @@? 01/02 13:33
XDucka:好像是廢話=.= 01/02 13:33