Can anyone check this out, why does this give me the default value of 0 instead of 1 ? Thank you.
Code:
#include <iostream>
#include <hash_map>
#include <string>
using namespace std;
int main()
{
stdext::hash_map<const char *, int> hm;
hm["abc"] = 1;
hm["def"] = 2;
string s = "abc";
cout << hm[s.c_str()];
return 0;
}
Comment