boost - How do you create a hash table in C++? -
i creating simple hash table in vs 2008 c++.
#include <map> std::map <string, char> grade_list; grade_list["john"] = 'b';
i getting error: error c2057: expected constant expression
what mean? boost library have better?
thanks!
#include <map> #include <iostream> #include <string> int main() { std::map<std::string, char> grade_list; grade_list["john"] = 'b'; std::cout << grade_list["john"] << std::endl; return 0; }
this works great g++. should specify std:: before string in map declaration, did in code.
Comments
Post a Comment