|
-
March 22nd, 2003, 01:42 AM
#1
hash_set and std::string
Friends, i am doing something like:
using namespace std;
hash_set<string> myhashstring;
myhashstring.insert("USA");
As such program is giving me error that:
(38): error C2440: 'type cast' : cannot convert from 'const std::string' to 'size_t'
But if i use "set" instead of "hash_set" the program works normally. Any one guess whats the problem ???
-
March 22nd, 2003, 05:16 AM
#2
hash_set is not part of ISO standard C++. It's entirely possible that there's a bug in whatever standard library implementation you're using. We'll need a few more details to pin it down, though.
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
-- Sutter and Alexandrescu, C++ Coding Standards
Programs must be written for people to read, and only incidentally for machines to execute.
-- Harold Abelson and Gerald Jay Sussman
The cheapest, fastest and most reliable components of a computer system are those that aren't there.
-- Gordon Bell
-
March 22nd, 2003, 07:34 AM
#3
I am using the hash_set implementation that comes with VC++ 7.0 compiler.
-
March 22nd, 2003, 07:38 AM
#4
Sorry, can't help, since I've not used VC++ 7.0
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
-- Sutter and Alexandrescu, C++ Coding Standards
Programs must be written for people to read, and only incidentally for machines to execute.
-- Harold Abelson and Gerald Jay Sussman
The cheapest, fastest and most reliable components of a computer system are those that aren't there.
-- Gordon Bell
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|