mercredi 4 mars 2015

Using unordered_map allocator's not default constructor

I would like to use a different allocator than the default one in unordered_map.

For my specific allocator, I want to call another constructor than the default one (I want to pass an int to the constructor).

I think the problem is that unordered_map calls the default constructor of my allocator.


So, Eventually I want to do something like that:


Instead of calling this unordered_map constructor:



std::tr1::unordered_map<int, int, std::tr1::hash<int>, std::equal_to<int>, MyAllocatorNs::MyAllocator<std::pair<const int, int> > > unorderedMap;


I want to do something like that:



std::tr1::unordered_map<int, int, std::tr1::hash<int>, std::equal_to<int>, MyAllocatorNs::MyAllocator<std::pair<const int, int> >(3) > unorderedMap;


Is it possible anyhow?


Aucun commentaire:

Enregistrer un commentaire