However, map is implemented with RB-tree to get relatively balance performance for any data.
If it is required a true hash table and not to re-implement one. Try this! But you have to use gcc.
#include
__gnu_cxx::hash_map variables;
The initial space of hash table can be defined with the table __stl_prime_list[]. It lists some prime
numbers to reduce collision of data or you can define it by yourself.
-- 2006/01/18 bbs backup --
原本寫好了list base的資節作業
但是覺得用搜尋的太慢了 而且寫起來很複雜
所以把他改成hash base的
正好可以學一學map的用法 從來沒用過
$. map
#include
map
value=par[key] to get value
par[key]=value to save value
par.count(key) 我是拿來測試有沒有建立過
map
for(it=par.begin(); it!=par.end(); it++) traverse all element
目前這樣就夠用了
沒有留言:
張貼留言