I'm trying to use boost::multi_index_container on a type that I've defined. I want the container to have two indices: 1. insertion order 2. hashed_unique Further, I want the hash to use an sha1 hash value, which I have represented as a struct. So, I have something like the following: struct sha1_hash_value { ... }; class MyRecord { public: ... sha1_hash_value hash() const { return _sha1_hash; } ... private: sha1_hash_value _sha1_hash; }; using namespace boost::multi_index; typedef boost::multi_index_container< MyRecord, indexed_by< sequenced<>, hashed_unique<const_mem_fun<MyRecord,sha1_hash_value,&MyRecord::hash> >
RecordSet;
When I compile this, I get lots of complaints regarding the conversions to/from the 'sha1_hash_value' type. I understand that I need to define appropriate member functions or specializations for this type. What I would like to know is what those member functions/specializations are and where that is documented so that I don't have to decipher compiler error gibberish iteratively and just cross my fingers that the errors are really about missing functionality and not about misuse. FWIW, if I change sha1_hash_value to a 'long', the code compiles, so it doesn't appear as if I'm completely misusing multi_index_container<>, though I'm certainly still open to that possibility as well. Thanks for any help. The brick wall I'm banging my head against is really starting to hurt.