type_index
is “a simple wrapper for type_info which can be used as an index type in associative containers (23.4) and in unordered associative containers (23.5)”. If you use type_index
instead of type_info*
, you will free yourself from having to provide an explicit comparator in your maps. The only cost is that you need to #include <typeindex>
.
Another benefit is that it will allow you to switch to (or also use) hashmaps (aka unordered_maps).
On the whole, since it simplifies your code, I’d say “go for it”.