summaryrefslogtreecommitdiff
path: root/xmloff/inc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-07 16:25:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-04-08 08:52:09 +0200
commit7be675cdfad328667bfbab043d71539dfd9e6fe6 (patch)
tree94a83c67d26aaffb513863a6ab0e4f8f72b2dc4d /xmloff/inc
parent1d556ff84dce01531ee334dc1408cebe50e97d22 (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 'xmloff/inc')
-rw-r--r--xmloff/inc/StyleMap.hxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/xmloff/inc/StyleMap.hxx b/xmloff/inc/StyleMap.hxx
index 8fb76e61104d..aef67399b8cd 100644
--- a/xmloff/inc/StyleMap.hxx
+++ b/xmloff/inc/StyleMap.hxx
@@ -22,6 +22,7 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <cppuhelper/implbase.hxx>
+#include <boost/functional/hash.hpp>
#include <unordered_map>
struct StyleNameKey_Impl
@@ -46,8 +47,10 @@ struct StyleNameHash_Impl
inline size_t StyleNameHash_Impl::operator()( const StyleNameKey_Impl& r ) const
{
- return static_cast< size_t >( r.m_nFamily ) +
- static_cast< size_t >( r.m_aName.hashCode() );
+ std::size_t seed = 0;
+ boost::hash_combine(seed, r.m_nFamily);
+ boost::hash_combine(seed, r.m_aName.hashCode());
+ return seed;
}
inline bool StyleNameHash_Impl::operator()(