
________________________________________ De: boost-users-bounces@lists.boost.org [boost-users-bounces@lists.boost.org] En nombre de Igor R [boost.lists@gmail.com] Enviado el: domingo, 13 de julio de 2008 21:29 Para: boost-users@lists.boost.org Asunto: Re: [Boost-users] [boost-users][multi-index] hashed identity: lookup by hash value [...]
What's not working is the second approach - with the hash_value template function as a the extractor of an additional key (it's not compiling).
It's weird, cause it ought to work. For instance, the following does it nicely both in GCC 3.4.4 and MSVC++ 8.0: #include <boost/multi_index/global_fun.hpp> #include <cstddef> #include <iostream> struct Element{}; template<typename T> std::size_t my_hash_value(const T&){return 0;} namespace mi=boost::multi_index; typedef mi::global_fun<const Element&,std::size_t,&my_hash_value > key_extractor; int main() { key_extractor k; Element e; std::cout<<k(e)<<std::endl; } What error messages are you getting? You can make your compiler's life easier by being a little more explicit when passing my_hash_value (though it's not obligatory to do so): typedef mi::global_fun<const Element&,std::size_t,&my_hash_value<Element> > key_extractor; If you provide me with a little more info about the errors you're getting maybe I can be more helpful. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo