What's wrong with this code?
-
Can anyone tell me why this code
#include <map> std::map<std::string, int> foo; int test_stl(std::string key) { return foo.find(key)->second; }
Gives me about a page of STL compilation errors in Visual Studio .NET? Can anyone give me an example of working code that uses a
hash_map
or amap
with anstd::string
key type? Why couldn't Science, in the long run, serve As well as one's uncleared lunch-table or Mme X en Culottes de Matador? James Merrill -
Can anyone tell me why this code
#include <map> std::map<std::string, int> foo; int test_stl(std::string key) { return foo.find(key)->second; }
Gives me about a page of STL compilation errors in Visual Studio .NET? Can anyone give me an example of working code that uses a
hash_map
or amap
with anstd::string
key type? Why couldn't Science, in the long run, serve As well as one's uncleared lunch-table or Mme X en Culottes de Matador? James MerrillIf you actually include the compile errors (or at least the first few), then it will make it a lot easier to determine what the problem is. Dave http://www.cloudsofheaven.org
-
Can anyone tell me why this code
#include <map> std::map<std::string, int> foo; int test_stl(std::string key) { return foo.find(key)->second; }
Gives me about a page of STL compilation errors in Visual Studio .NET? Can anyone give me an example of working code that uses a
hash_map
or amap
with anstd::string
key type? Why couldn't Science, in the long run, serve As well as one's uncleared lunch-table or Mme X en Culottes de Matador? James MerrillLooks like you just need to
#include <string>
:#include <map>
#include <string>
std::map<std::string, int> foo;
int test_stl(std::string key){
return foo.find(key)->second;
}- Mike
-
Looks like you just need to
#include <string>
:#include <map>
#include <string>
std::map<std::string, int> foo;
int test_stl(std::string key){
return foo.find(key)->second;
}- Mike
Duh! Thanks for setting me straight.