Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Using Concurrent Hash Map.

mr_stevenfeldman
Beginner
274 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