2009-06-30 13 views
3

は、私はちょうどその場合は私が働いているもののためのより高速なアロケータを見るために、ブースト::プールを試していますが、私はブースト:: unordered_mapとそれを使用する方法を見つけ出すことはできません。ここでboost :: unordered_mapでboost :: pool_allocatorを使用する構文は何ですか?

がありますコードスニペット:

エラー3エラーC2064:\プログラムファイル(x86の)\ブースト\ boost_1_38 \:用語は、2つの引数Cを取る関数に評価しません。ここ

unordered_map<int,int,boost::hash<int>, fast_pool_allocator<int>> theMap; 
theMap[1] = 2; 

は私が手コンパイルエラーですboost \ unordered \ detail \ hash_table_impl.hpp 2048

地図の使用をコメントアウトすると、 "theMap [1] = 2"コンパイルエラーが消えます。

答えて

7

template parameterが見つからないようです。

template<typename Key, typename Mapped, typename Hash = boost::hash<Key>, 
    typename Pred = std::equal_to<Key>, 
    typename Alloc = std::allocator<std::pair<Key const, Mapped> > > 

第4引数は比較の述語であり、第5引数はアロケータです。

unordered_map<int, int, boost::hash<int>, 
    std::equal_to<int>, fast_pool_allocator<int> > theMap; 

また、おそらくないあなたの問題の原因は、あなたがテンプレートのインスタンスの終わりに2「>」分離する必要があります。

+0

ありがとうございました。 –

関連する問題