Created
October 21, 2011 12:26
-
-
Save yangacer/1303695 to your computer and use it in GitHub Desktop.
hash_map shapshot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
using namespace std; | |
using namespace BDB; | |
using BDB::Structure::HashMap; | |
Config conf; | |
conf.beg = 1; | |
conf.end = 10; | |
conf.root_dir = argv[1]; | |
BehaviorDB bdb(conf); | |
HashMap<int> hmap("my_map", bdb); | |
string buf; | |
hmap.put("key", "value"); | |
hmap.is_in("key"); | |
hmap.get("key", &buf); | |
hmap.get_bucket("key"); | |
size_t hv = hmap.hash_function("key"); | |
HashMap<int>::BucketType bucket; | |
hmap.get_bucket(hv, &bucket); | |
for(HashMap<int>::BucketType::iterator it = bucket.begin(); | |
it != bucket.end(); ++it) | |
cout<<it->first<<":"<<it->second<<"\n"; | |
bucket.erase(bucket.begin()); | |
hmap.update_bucket("key", bucket); | |
return 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment