mardi 11 septembre 2018

Getting the type of a value in std::map without knowing the key

I have a map that is, say:

 std::map<int,string> aMap;
 aMap.insert(make_pair(0,"hello world");

Is there any way to determine that the value is string without knowing that the ket is int?

I threw up a hail mary:

 void* it = aMap.begin();

But that just spit back errors. Is there any way to do this? It should be noted that I am limited to C++03; however, if there is way to do this in C++11 or beyond, it would be cool to know.





Aucun commentaire:

Enregistrer un commentaire