Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Using Concurrent Hash Map.

mr_stevenfeldman
Beginner
181 Views
I am a student, and I am researching concurrent data structures. I don't have much experience in C++ templates/classes. However I understand the concepts.
My main problem is understanding how to call basic insert, get and delete operations on the hash map.
here is my code:
struct HashCompare {
static size_t hash( const K& key ) {
return tbb::tbb_hasher(key);
}
static bool equal( const K& key1, const K& key2 ) {
return ( key1 == key2 );
}
};
typedef tbb::concurrent_hash_map > hash_t;
hash_t *hash;
//Prefill
for(i = start; i < operations+start; i++){
int op=(int)random()%100;
if(op<=get_rate){
hash_t::accessor a;
hash->find(a,i);
}
else if (op<=insert_rate){
value=(int)random();
hash_t::accessor a;
hash->insert(a,value);
}
else{//get rate
hash->erase(value);
}
}
When I run my code i get a bunch of erros, that don't make much sense to me, see attached file.
Also how do u set the vale of an accessor?
Code:
0 Kudos
0 Replies
Reply