What syntax to use boost :: pool_allocator with boost :: unordered_map?

I am just experimenting with boost :: pool to find out if it has a faster dispenser to work with which I work, but I cannot figure out how to use it with boost :: unordered_map:

Here is the code snippet:

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

Here is the compilation I get:

Error 3 of error C2064: the term does not evaluate a function with two arguments C: \ Program Files (x86) \ boost \ boost_1_38 \ boost \ unordered \ detail \ hash_table_impl.hpp 2048

If I comment on the use of the map, for example. "theMap [1] = 2", then the compilation error disappears.

+3
source share
1 answer

, .

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> > > 

- , - .

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

, , , , " > " ​​ .

+7

Source: https://habr.com/ru/post/1711540/


All Articles