STL Map Problem with user defined Class
I've a Class called Var which handles multiple basic datatypes like int, float, char, string etc..
that Class works file when I use it like this.
Code:
Var x = (Var)2;
cout<<x;
But When I made a map of string and var its going Crazy.
Code:
typedef vector<string> stringList;
typedef map<string, Var> paramsMap;
int main(int argc, char *argv[]){
paramsMap lst;
lst["x"] = (Var)2;
lst["y"] = (Var)5;
for(paramsMap::iterator it=lst.begin();it != lst.end();it++){
cout<<it->first<<" => "<<it->second<<endl;
}
return EXIT_SUCCESS;
}
The Above Should Output.
But whet its showing is.
Here is my code for var.h and var.cpp
var.h
http://pastebin.com/m576e6998
var.cpp
http://pastebin.com/m57e02d88
toString()
http://pastebin.com/m788b6711