boost-unordered

boost::unordered_map missing reserve() like std::unordered_map

China☆狼群 提交于 2020-01-21 18:34:44
问题 For my next task I need to use a very big hash; since I have an old compiler I cannot use C++0x std::unordered_map . Ideally I need is a call to reserve to make room in advance for a large number of items. I cannot find this method in boost::unordered_map : is there any place or function that achieves the same? The 2 associative container are the same; I can see rehash function and the same constructor for controlling the number of buckets, but not a function about a number of elements. Can

Maps of maps allocated in shared memory

前提是你 提交于 2020-01-02 08:22:54
问题 Inside a boost::interprocess::managed_shared_memory , I am trying to create boost::unordered_map inside another boost::unordered_map as value, having key as std::string for both maps. This Map in Map inside a shared memory segment gets accessed by two different processes fetch values from both outer & inner maps. Below is my implementation & want to know if this is possible/right way or any other better way possible? boost::interprocess::managed_shared_memory segment(boost::interprocess::open

insert to boost unordered map

房东的猫 提交于 2019-12-23 19:33:05
问题 Hi I'm trying to insert a record into a boost::unordered_map Map is defined as boost::unordered_map<int,Input> input_l1_map; where Input is the class class Input { int id; std::string name; std::string desc; std::string short_name; std::string signal_presence; std::string xpnt; } I use a function to insert the record as below void RuntimeData::hash_table(int id,Input input) { this->input_l1_map.insert(id,input); } I read the boost documentation it says a function insert() to insert data to

C++ some questions on boost::unordered_map & boost::hash

不打扰是莪最后的温柔 提交于 2019-12-19 06:25:12
问题 I've only recently started dwelling into boost and it's containers, and I read a few articles on the web and on stackoverflow that a boost::unordered_map is the fastest performing container for big collections. So, I have this class State, which must be unique in the container (no duplicates) and there will be millions if not billions of states in the container. Therefore I have been trying to optimize it for small size and as few computations as possible. I was using a boost::ptr_vector

Boost interprocess unordered_map compilation

早过忘川 提交于 2019-12-10 10:07:23
问题 I'm using boost 1.53 and GCC 4.1.2 . I've tried to use boost unordered_map in some tests (documentation says, that it should work with shared memory), but i'm unable to compile my code. With interprocess::map instead of unordered everything is ok. Typedefs: typedef boost::interprocess::allocator<char, SegmentManager> CharAllocator; typedef boost::interprocess::basic_string<char, std::char_traits<char>, CharAllocator> ShmString; typedef ShmString HashKeyType; //ComplexType is a wrapper for

unordered_map with gregorian dates

穿精又带淫゛_ 提交于 2019-12-07 05:19:50
问题 I would like to store boost::gregorian::date as key of a boost::unordered_map but I cannot compile the code as it is missing a proper hash function for this class. An easy solution would be converting to std::string and store it. I possibly would like to avoid this solution as using string is quite expensive. I tried to find some function exporting a date to number but I can read only the day() function and I am not sure if this is really suitable. Maybe I can calculate the number of days

Boost interprocess unordered_map compilation

旧城冷巷雨未停 提交于 2019-12-06 00:39:30
I'm using boost 1.53 and GCC 4.1.2 . I've tried to use boost unordered_map in some tests (documentation says, that it should work with shared memory), but i'm unable to compile my code. With interprocess::map instead of unordered everything is ok. Typedefs: typedef boost::interprocess::allocator<char, SegmentManager> CharAllocator; typedef boost::interprocess::basic_string<char, std::char_traits<char>, CharAllocator> ShmString; typedef ShmString HashKeyType; //ComplexType is a wrapper for internal interprocess::map typedef ComplexType HashMappedType; typedef std::pair<const ShmString,

C++ some questions on boost::unordered_map & boost::hash

荒凉一梦 提交于 2019-12-01 04:07:56
I've only recently started dwelling into boost and it's containers, and I read a few articles on the web and on stackoverflow that a boost::unordered_map is the fastest performing container for big collections. So, I have this class State, which must be unique in the container (no duplicates) and there will be millions if not billions of states in the container. Therefore I have been trying to optimize it for small size and as few computations as possible. I was using a boost::ptr_vector before, but as I read on stackoverflow a vector is only good as long as there are not that many objects in