Boost logo

Boost Users :

Subject: Re: [Boost-users] [Unordered] [Multi-Index] Set lookup from something else than key_type
From: Daniel James (daniel_james_at_[hidden])
Date: 2009-09-02 05:43:03


2009/9/2 <joaquin_at_[hidden]>:
>>
>> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net