Fix broken 64bit hash in tbb

Fixes #181
release/4.3a0
Jose Luis Blanco-Claraco 2019-12-10 12:20:31 +01:00 committed by Jose Luis Blanco Claraco
parent 8ca7773e50
commit d0971104ce
No known key found for this signature in database
GPG Key ID: D443304FBD70A641
1 changed files with 13 additions and 5 deletions

View File

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