
2 Sep
2009
2 Sep
'09
9:43 a.m.
2009/9/2
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.
I don't think I can require custom functions to comply with that. There'd have to be some kind of type trait to indicate support for the type. It might be possible to detect that using SFINAE. Daniel