
Daniel James escribió:
2009/9/1 Joaquin M Lopez Munoz
: Dominique Devienne
writes: Any reason why unordered cannot allow similar "compatible key" lookups?
There is no technical reason why Boost.Unordered couldn't provide the compatible key functionality. It just happens not to be a feature condidered in the standard, but if you convince the author to add it as an extension implementing it should be trivial.
AFAICT if the hash function doesn't support the type that you supply it will implicitly construct a key for every call to the hash function and equality predicate. Which is a problem.
Yep, the hash function and equality predicate the user provides have to have overloads of operator() for the compatible key as well as the key, as shown in the example at: http://www.boost.org/libs/multi_index/doc/tutorial/indices.html#hash_lookup This way no key is unnecessarily constructed, which is the point of the compatible key idea. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo