boost-bimap

Is C++ bimap possible with one side of view having different key than other side of the view value? How to do that?

我们两清 提交于 2020-01-06 06:07:26
问题 At the beginning I needed a map, so I used std::map. Then, some requirements were added and I needed to also get "keys" for "value" (foos for bar), so I used boost::bimaps::bimap< boost::bimaps::unordered_set_of<boost::bimaps::tagged<std::string, foo>>, boost::bimaps::multiset_of<boost::bimaps::tagged<std::string, bar>>> And after that, some more requirements were added, so now I need to store a number for every foo and from the right side view I need to be able to call <bimap>.righ.find(bar)

Add values to a multiset in a boost::bimap

孤人 提交于 2020-01-05 07:05:00
问题 I wanted to use a multimap version of a boost::bimap and I am following this, Boost::Bimap equivalent of bidirectional multimap This shows how to add and retrieve values in the structure. I am trying to look up based on a value on the right that maps to multiple values on the left, and if found, I would like to add to the list on the left. For example, assume, this is the bimap, value_type(1, 1) value_type(10, 50) value_type(1, 2) value_type(9, 15) and when you do a bimap.left.equal_range(1);

Add values to a multiset in a boost::bimap

泪湿孤枕 提交于 2020-01-05 07:03:44
问题 I wanted to use a multimap version of a boost::bimap and I am following this, Boost::Bimap equivalent of bidirectional multimap This shows how to add and retrieve values in the structure. I am trying to look up based on a value on the right that maps to multiple values on the left, and if found, I would like to add to the list on the left. For example, assume, this is the bimap, value_type(1, 1) value_type(10, 50) value_type(1, 2) value_type(9, 15) and when you do a bimap.left.equal_range(1);

Insert boost::dynamic_bitset<> into boost::bimap

孤街浪徒 提交于 2019-12-25 11:55:27
问题 I am trying to insert boost::dynamic_bitset<> into boost::bimap . However, it is very slow as compared to inserting integers or strings. Minimal Example is given, the code of which is shown below // Example program #include <iostream> #include <string> #include <boost/bimap.hpp> #include <boost/dynamic_bitset.hpp> #include <boost/bimap/unordered_set_of.hpp> #include <boost/bimap/unordered_multiset_of.hpp> namespace std { template <typename Block, typename Alloc> struct hash<boost::dynamic

Is it legal to re-declare a member class after defining it?

白昼怎懂夜的黑 提交于 2019-12-13 05:46:30
问题 I have a problem with compiling boost.bimap library. My test program is a blank main function and only one include directive(like #include <boost/bimap.hpp> ). After some investigations I found out that preprocessor had made some interesting constructions from header file like: struct A { struct B{}; struct B; }; I don't know if this is correct or not, but gcc accepts it while clang and icc don't. Who is right and what can I do to compile programs with bimap library? Unfortunately, I can't

Using boost::associative property map with boost::BIMAP interface

帅比萌擦擦* 提交于 2019-12-02 05:48:38
问题 I am not able to implement associative property map interface of boost for a boost bimap. I have a bimap as follows and I try to define a boost::associative property map for it. I want to use Put and Get helper functions for my bimap.. the code is as follows: typedef boost::bimaps::bimap< vertex_descriptor_t, size_t > vd_idx_bimap_t; typedef boost::associative_property_map< vd_idx_bimap_t > asso_vd_idx_bimap_t; // define bimap vd_idx_bimap_t my_bimap; asso_vd_idx_bimap_t my_asso_bimap(my

Serialize boost::bimap with boost::dynamic_bitset as key value pair

混江龙づ霸主 提交于 2019-12-02 04:21:00
问题 I am interested to serialize a boost::bimap containing boost::dynamic_bitset so that I can save that and load back when needed. I have made an attempt to do that but I get many errors. The code that I have with me is as below. // Example program #include <iostream> #include <string> #include <fstream> #include <boost/bimap.hpp> #include <boost/dynamic_bitset.hpp> #include <boost/bimap/unordered_set_of.hpp> #include <boost/bimap/unordered_multiset_of.hpp> #include <boost/archive/binary

Using boost::associative property map with boost::BIMAP interface

旧巷老猫 提交于 2019-12-02 01:47:54
I am not able to implement associative property map interface of boost for a boost bimap. I have a bimap as follows and I try to define a boost::associative property map for it. I want to use Put and Get helper functions for my bimap.. the code is as follows: typedef boost::bimaps::bimap< vertex_descriptor_t, size_t > vd_idx_bimap_t; typedef boost::associative_property_map< vd_idx_bimap_t > asso_vd_idx_bimap_t; // define bimap vd_idx_bimap_t my_bimap; asso_vd_idx_bimap_t my_asso_bimap(my_bimap); I get a compile error as error: no type named âsecond_typeâ in âboost::bimaps::container_adaptor:

Insert into boost::BIMAP using BOOST::associative property map … failed

霸气de小男生 提交于 2019-12-01 19:41:09
问题 With reference to my previously asked question about boost::bimaps and boost associative property maps interface here, I want to use Put and Get helper functions for my bimap. With reference to a sample code given here, I tried to add the following and i get a long compile error for assertion failed ... Here is the code : #include <boost/bimap.hpp> #include <boost/property_map/property_map.hpp> #include <boost/bimap/property_map/set_support.hpp> #include <iostream> using namespace boost; int

Insert into boost::BIMAP using BOOST::associative property map … failed

强颜欢笑 提交于 2019-12-01 18:34:35
With reference to my previously asked question about boost::bimaps and boost associative property maps interface here , I want to use Put and Get helper functions for my bimap. With reference to a sample code given here , I tried to add the following and i get a long compile error for assertion failed ... Here is the code : #include <boost/bimap.hpp> #include <boost/property_map/property_map.hpp> #include <boost/bimap/property_map/set_support.hpp> #include <iostream> using namespace boost; int main() { typedef int vertex_descriptor_t; typedef boost::bimaps::bimap< vertex_descriptor_t, size_t >