Reputation: 1131
I have question with Boost::bimap and could not find answer from boost document.
using AToBBimap = boost::bimap< boost::bimaps::unordered_set_of<CString>, boost::bimaps::multiset_of<CString> >; //hashed bimap
using AToBBimapValueT = AToBBimap ::value_type;
AToBBimap bi_map;
bi_map.insert(AToBBimapValueT{"message1", "value"});
bi_map.insert(AToBBimapValueT{"message2", "value"});
bi_map.right.find("value");
QUESTION: with bi_map.right.find("value")
looks like can only get iterator to {"message1", "value"}
, is there possible to get a list of both matching like [{"message1", "value"}, {"message2", "value"}]
?
Upvotes: 1
Views: 429
Reputation: 1131
The answer is equal_range("value")
, like with std::multiset
and std::multimap
.
That member returns a pair of iterators, which is conveniently compatible with Boost's iterator-range factory, so you can use it:
for (auto p : boost::make_iterator_range(bi_map.right.equal_range("value")))
do something with p.second;
Upvotes: 3