
Daniel James escribió:
2009/9/2 <joaquin@tid.es>:
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.
Yep, I now see your POV and this is admittedly something people can disagree on. Another possibility is that Boost.Unordered provide const_iterator find(const key_type& k) const; template< typename CompatibleKey,typename CompatibleHash,typename CompatiblePred
iterator find( const CompatibleKey& k, const CompatibleHash& hash,const CompatiblePred& eq)const; which is a pure extension without backwards compatibility problems. This is seemingly what Boost.Intrusive is doing. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo