Merge pull request #186 from borglab/fix/tbb-hash-32bit

Fix broken 64bit hash in tbb in 32bit builds
release/4.3a0
Jose Luis Blanco-Claraco 2019-12-14 00:04:48 +01:00 committed by GitHub
commit ecd65b1ad9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

@ -29,14 +29,22 @@
# undef max # undef max
# undef ERROR # undef ERROR
#include <functional> // std::hash()
// Use TBB concurrent_unordered_map for ConcurrentMap // Use TBB concurrent_unordered_map for ConcurrentMap
# define CONCURRENT_MAP_BASE tbb::concurrent_unordered_map<KEY, VALUE> template <typename KEY, typename VALUE>
using ConcurrentMapBase = tbb::concurrent_unordered_map<
KEY,
VALUE,
std::hash<KEY>
>;
#else #else
// If we're not using TBB, use a FastMap for ConcurrentMap // If we're not using TBB, use a FastMap for ConcurrentMap
# include <gtsam/base/FastMap.h> #include <gtsam/base/FastMap.h>
# define CONCURRENT_MAP_BASE gtsam::FastMap<KEY, VALUE> template <typename KEY, typename VALUE>
using ConcurrentMapBase = gtsam::FastMap<KEY, VALUE>;
#endif #endif
@ -57,11 +65,11 @@ namespace gtsam {
* @addtogroup base * @addtogroup base
*/ */
template<typename KEY, typename VALUE> template<typename KEY, typename VALUE>
class ConcurrentMap : public CONCURRENT_MAP_BASE { class ConcurrentMap : public ConcurrentMapBase<KEY,VALUE> {
public: public:
typedef CONCURRENT_MAP_BASE Base; typedef ConcurrentMapBase<KEY,VALUE> Base;
/** Default constructor */ /** Default constructor */
ConcurrentMap() {} ConcurrentMap() {}