Skip to content

Commit

Permalink
Fix broken 64bit hash in tbb
Browse files Browse the repository at this point in the history
Fixes #181
  • Loading branch information
jlblancoc committed Dec 10, 2019
1 parent 60d820e commit 1b391cd
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions gtsam/base/ConcurrentMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 CONCURRENT_MAP_BASE = 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 CONCURRENT_MAP_BASE = gtsam::FastMap<KEY, VALUE>;

#endif

Expand All @@ -57,11 +65,11 @@ namespace gtsam {
* @addtogroup base
*/
template<typename KEY, typename VALUE>
class ConcurrentMap : public CONCURRENT_MAP_BASE {
class ConcurrentMap : public CONCURRENT_MAP_BASE<KEY,VALUE> {

public:

typedef CONCURRENT_MAP_BASE Base;
typedef CONCURRENT_MAP_BASE<KEY,VALUE> Base;

/** Default constructor */
ConcurrentMap() {}
Expand Down

0 comments on commit 1b391cd

Please sign in to comment.