Can anyone provide a simple example of how to use the Boost Intrusive Hashtable? I've tried to implement it, but I'm having little luck.
I have this so far
void HashTableIndex::addToIndex(Message* message)
{
hashtable<MyMessageVector>::bucket_type base_buckets[10000];
hashtable<MyMessageVector> htable(hashtable<MyMessageVector>::bucket_traits(base_buckets, 10000));
boost::array<MyMessageVector,10000> items;
htable.insert_unique(items[0]);
but for some reason it's not calling my Hash function which is defined above like this
size_t HashTableIndex::hash_value(MyMessageVector& b)
{
boost::hash<string> hasher;
return hasher(b.getKey());
};
For some reason it won't call my hash_value function. Any help on this would be much appreciated!
You can supply the hash function to the hash table using
boost::intrusive::hash
in the list of options.