October 9th, 2003, 11:12 AM
Dreaded char* const problems
Let me start by saying I am using Emin Martinian's my_hash_map for my hash_map.
I seem to be having a problem with calling the find function and passing a value to the char* const & parameter.
find(char* const &);
I use the std::string for most of my lookups, but with this guy, I seem to be having a problem.
// Pseudo code start
// Pseudo code end
Here is a link to his my_hash_map.h
Anything special I should be doing here with the string? I've even been looking at Stroustraps' book and can't seem to find an answer
October 12th, 2003, 01:43 AM
without seeing your declaration of your variable myhashmap, it's hard to be specific. I *assume* you've done something like
my_hash_map<char *, some_hash_value_type, some_hasher, some_comparer> myhashmap;
In which case, the trick would be to do
char *temp = const_cast<char *>(strkey.c_str());
The reason for the temporary is to have something that can be passed by reference to the temp function. If you don't have that, some compilers may generate a temp for you, but may introduce quirky side effects when they do.
If your hash type is some other type (i.e. not a char *) that is the cause of your problem.