Changing from std::map to boost::bimap
Hi: I am looking to change from std::map to boost::bimap. I have the following defined: std::bimap<std::bitset<6>, int, BitSetComp> DotsList; And boost::bimap<std::bitset<6>, int, BitSetComp>::iterator DotsIterator; If it's needed BitsetComp is defined as: struct BitSetComp { bool operator()(const std::bitset<6>& lhs, const std::bitset<6>& rhs) const { return lhs.to_ulong() < rhs.to_ulong(); } }; How do I change these definitions to use boost::bimap. Any help apreciated. Chers Sean. __________ Information from ESET NOD32 Antivirus, version of virus signature database 3401 (20080829) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
On Aug 31, 2008, at 6:56 AM, Sean Farrow wrote:
I am looking to change from std::map to boost::bimap. I have the following defined: std::bimap<std::bitset<6>, int, BitSetComp> DotsList; And boost::bimap<std::bitset<6>, int, BitSetComp>::iterator DotsIterator; [SNIP] How do I change these definitions to use boost::bimap. Any help appreciated.
A bimap can act as two regular maps, and does so through two special public data members. The "left" member acts like a map<bitset, int, BitSetComp>, and the "right" member flips the first two arguments. There are also type-aliases defined for each iterator, left or right. There is also a mode that acts like a std::set< std::pair< std::bitset< 6 >, int > > >. Read the docs for the specific names and modes. -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com
participants (2)
-
Daryle Walker
-
Sean Farrow