Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6237: unordered_set behaves differently from 1.46 to 1.48
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-08 08:58:47
#6237: unordered_set behaves differently from 1.46 to 1.48
-------------------------------------------------------+--------------------
Reporter: Chris Meyer <cmeyer1969+boost@â¦> | Owner: danieljames
Type: Bugs | Status: new
Milestone: To Be Determined | Component: unordered
Version: Boost 1.48.0 | Severity: Regression
Resolution: | Keywords:
-------------------------------------------------------+--------------------
Comment (by anonymous):
No, it's valid, you're using a custom `operator==` so for it to work you
need to use a custom hash function. For this case,:
{{{
bool operator==(const cptr &c1, const cptr &c2) { return true; }
// Since cptr is always equal just hash to the same value.
std::size_t hash_value(const cptr& c1) { return 1; }
}}}
The hash function for your real code depends on what your equality
operator does. This only worked before because there was a bug for hashing
shared_ptr so they all went into the same bucket. This worked but was very
inefficient.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6237#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC