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 07:35:40


2009/9/2 <joaquin_at_[hidden]>:
> Daniel James escribió:

>> But those overloads don't always exist. A simple example is:
>>
>>    struct hash {
>>        std::size_t operator()(std::string const&) const;
>>    };
>>
>>    struct equals {
>>        bool operator()(std::string const&, std::string const&) const;
>>    };
>>
>>    boost::unordered_map<std::string, int, hash, equals> map;
>>    // ....
>>    map.find("char array");
>>
>> A single string object should be created in this case.
>>
>
> Correct, but it's the user's responsibility, not yours, to make sure the
> hash and
> equality functors used have the appropriate overloads.

I disagree, I'd see what I wrote as reasonable use of the STL.


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