diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-07 16:25:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-08 08:52:09 +0200 |
commit | 7be675cdfad328667bfbab043d71539dfd9e6fe6 (patch) | |
tree | 94a83c67d26aaffb513863a6ab0e4f8f72b2dc4d /basctl | |
parent | 1d556ff84dce01531ee334dc1408cebe50e97d22 (diff) |
improve combining in hash functions
specifically, use boost::hash_combine to combine values in hash
functions, except for a couple of places where I use the
small-prime-number strategy popular in the Java world, to avoid
including boost in header files that are widely shared.
Change-Id: I0e184c9ec8803bf09fc6e84fe20131b203e1652a
Reviewed-on: https://gerrit.libreoffice.org/70384
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 6fe3475c49e8..ffb3e9d87f83 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -36,6 +36,7 @@ #include <svl/srchdefs.hxx> #include <vcl/weld.hxx> #include <tools/stream.hxx> +#include <boost/functional/hash.hpp> namespace basctl { @@ -693,7 +694,10 @@ bool LibInfo::Key::operator == (Key const& rKey) const size_t LibInfo::Key::Hash::operator () (Key const& rKey) const { - return rKey.m_aDocument.hashCode() + rKey.m_aLibName.hashCode(); + std::size_t seed = 0; + boost::hash_combine(seed, rKey.m_aDocument.hashCode()); + boost::hash_combine(seed, rKey.m_aLibName.hashCode()); + return seed; } LibInfo::Item::Item ( |