| 1 | #include <typeinfo>
|
|---|
| 2 | #include <typeindex>
|
|---|
| 3 | #include <boost/container/flat_map.hpp>
|
|---|
| 4 | #include <map>
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 | int main()
|
|---|
| 8 | {
|
|---|
| 9 | typedef int handler_t;
|
|---|
| 10 |
|
|---|
| 11 | //typedef boost::container::flat_multimap<std::type_index, handler_t> handlers_map_t;
|
|---|
| 12 | //typedef boost::container::flat_map<std::type_index, handler_t> handlers_map_t;
|
|---|
| 13 | //typedef std::multimap<std::type_index, handler_t> handlers_map_t;
|
|---|
| 14 | //typedef std::map<std::type_index, handler_t> handlers_map_t;
|
|---|
| 15 |
|
|---|
| 16 | handlers_map_t handlers;
|
|---|
| 17 |
|
|---|
| 18 | // this does not compile with flat_multimap, but does compile with flat_map, std::multimap and std::map
|
|---|
| 19 | const auto matching = handlers.equal_range(std::type_index(typeid(int)));
|
|---|
| 20 |
|
|---|
| 21 | return 0;
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|