Questions tagged [boost-bimap]

Boost.Bimap is a bidirectional maps library for C++.

38 questions
27
votes
4 answers
5
votes
1 answer

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

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…
Pogo
  • 475
  • 3
  • 19
4
votes
1 answer

OPERATOR_BRACKET_IS_NOT_SUPPORTED on boost::bimap

I am trying to use the bracket operator on a boost::bimap but without success. For the problem I seek to solve I need a bimap that fulfills the following requirement: left sorted, unique int right non unique, non sorted type This lead me to…
Stereo
  • 1,148
  • 13
  • 36
4
votes
1 answer

Convert boost::bimap to std::map

The obvious way to convert a bimap to std::map, doesnt seem to work. Is below the correct/good way to convert? Is there a better/shorter way? typedef boost::bimap MapType; MapType _bimap; //Fill _bimap MapType::left_map& lmap =…
balki
  • 26,394
  • 30
  • 105
  • 151
3
votes
2 answers

C++ data structure to store multiple relationships between two unique sets of elements

I am working on a project where I have two unique sets of elements. Any of the elements in one set may be related to any of the elements in the other set. Example: Set 1: {A, B, C} Set 2: {1, 2, 3, 4} Allowed relationships: (A, 1) (A, 3) (B, 1)…
npp1993
  • 330
  • 4
  • 20
2
votes
1 answer

Shift values in boost::bimap

I have an unordered bimap like this: using SymPressMap = boost::bimap, boost::bimaps::unordered_set_of>; Which is basically a bijection between "sym" and "Press". I want to cycle the…
2
votes
1 answer

Struggling to create a Boost-Bimap containing std::bitset

I have a number of strings and their bitset equivalents. I need to be able to look up equivalents in both directions, i.e. "str to bitset" and "bitset to str". I believe boost-bimap would be the right container for this job. I managed to get this to…
W.R.
  • 23
  • 3
2
votes
1 answer

Is boost::bimap overkill for injective functions?

Let T_1 and T_2 be two types and f: Dom(T_1) -> Dom(T_2) be an injective function which is not a bijection; and for the sake of discussion suppose I get a representation of f as disparate pairs rather than code for computing it. Now, I need to be…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
2
votes
1 answer

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

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…
AwaitedOne
  • 992
  • 3
  • 19
  • 42
2
votes
1 answer

Access value with key in bimap

I am trying to get a value accessed by its key. I have a minimal example that I tried so far, and works fine only for left side access. #include #include #include #include #include…
AwaitedOne
  • 992
  • 3
  • 19
  • 42
2
votes
1 answer

Conflicting specifiers in declaration c++

I use a data structure bimap typedef boost::bimap< std::string, int > hash_bimap; typedef hash_bimap::value_type position; hash_bimap perm; and it works fine in main file. However, i am interested to use it in header file to make it accessible in…
AwaitedOne
  • 992
  • 3
  • 19
  • 42
2
votes
1 answer

How can I use boost::bimap in an unordered and mutable way?

I'm looking for a bidirectional unordered map. Currently, I just have this. The problem is, that I can't use []. What I think is that boost defaults to list types. But I want a hashmap. How's this possible? #include #include…
danijar
  • 32,406
  • 45
  • 166
  • 297
2
votes
1 answer

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

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…
Pogo
  • 475
  • 3
  • 19
1
vote
0 answers

Advantage of boost::bimap::unordered_set_of v/s std::unordered_set

I'm using a bidirectional map to link a list of names to a particular single name (for example, to correlate cities and countries). So, my definition of the type is something like: using boost::bimap,…
1
vote
1 answer

Failing to work around g++ 7.1 structured binding bug with Boost.Bimap

In my project I am using Boost.Bimap to implement bidirectional maps. Look at this very simple MCVE on godbolt, where I am using structured binding to print the key-value pair of the right map (which, according to the documentation, is…
andreee
  • 4,459
  • 22
  • 42
1
2 3