I have been searching the forums and google and having a hard time understanding how I can do what I want.
My example is based of typical dataset you see for an election. I want to split a delimited string and create a map to access later The string looks like this: "name=candidate1;vote=1000;percent=10.5"
I am able to create my map of strings as follows
while (getline(oss, key, '=') && getline(oss, value))
{
mCanData.insert(std::pair<std::string, std::string>(key, value));
}
What I would like to do, and I do not know if this is possible, is to insert the values in the map with different datatypes(i.e.key = "name" value ="candidate1", key = "vote" value =1000, key="percent" value=10.5). The map I want to create will set a private class variable that can be accessed later through a getter by other classes. I am not able to use the boost library so please do not suggest that.
Any help would be great as I am lost right now. If there is a better way to go about this I would like to know that as well.