How can I implement a map with different data types as values?
You want to use boost::variant
:
std::map <std::string, boost::variant<typeX, typeY>>
Are typeX and typeY subclasses of a typeBase class ?
If so, you could do a std::map<std::string,typeBase*>
to store both typeX* and typeY* in the map.