jeudi 4 août 2016

C++ Simplest way to store multiple data types for value(int and string) in map

I want to have a map that uses

  • string for key
  • int OR string for value

like this:

std::map<std::string, SOME TYPE> myMap;
myMap["first_key"]  = 10;
myMap["second_key"] = "stringValue";

What is the SIMPLEST way to do such thing?

Aucun commentaire:

Enregistrer un commentaire