2016-04-27 86 views
1

我正在嘗試使用TBB concurrent_hash_map容器。在example之後,表明我需要3個類型參數(模板參數),鍵和值類型以及特徵類型HashCompare。在this鏈接中,它表示HashCompare具有基本類型的默認值。TBB併發哈希映射模板參數

但是,當試圖以兩種方式(2或3個模板參數)中的任何一種方式使用它時,我收到一個關於「太少模板參數,期望4」的錯誤 - 實際上在挖掘代碼時,唯一的定義在頭文件中的concurrent_hash_map,我能找到有四個參數的:

class concurrent_hash_map<Key,T,HashCompare,Allocator> 

我失去的東西,就是例子已經過時?

回答

2

還有另一個聲明,其中有最後兩個參數的默認值。請確保您有必要的頭文件:

#include <tbb/concurrent_hash_map.h> 

在我的版本TBB的,該文件有:

template<typename Key, typename T, typename HashCompare = tbb_hash_compare<Key>, typename A = tbb_allocator<std::pair<Key, T> > > 
class concurrent_hash_map;