| 1 | #include <iostream>
|
|---|
| 2 | #include <boost/container/flat_map.hpp>
|
|---|
| 3 |
|
|---|
| 4 | typedef boost::container::flat_multimap<int,int> IntMap;
|
|---|
| 5 |
|
|---|
| 6 | class MapTest {
|
|---|
| 7 | public:
|
|---|
| 8 | MapTest() {}
|
|---|
| 9 | MapTest(IntMap const &map) :
|
|---|
| 10 | _map(map) {
|
|---|
| 11 | _map.insert(map.begin(), map.end());
|
|---|
| 12 | }
|
|---|
| 13 | IntMap const& getMap() {return _map; }
|
|---|
| 14 | private:
|
|---|
| 15 | IntMap _map;
|
|---|
| 16 | };
|
|---|
| 17 |
|
|---|
| 18 | int main(int argc, char *argv[]) {
|
|---|
| 19 |
|
|---|
| 20 | using std::cout;
|
|---|
| 21 | using std::endl;
|
|---|
| 22 |
|
|---|
| 23 | IntMap iMap;
|
|---|
| 24 | for(int i = 0; i < 1000; i++) {
|
|---|
| 25 | iMap.emplace(i, i);
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | MapTest map(iMap);
|
|---|
| 29 | for(auto const &kvPair : map.getMap()) {
|
|---|
| 30 | cout << kvPair.first << " : " << kvPair.second << endl;
|
|---|
| 31 | }
|
|---|
| 32 | return 0;
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|