help with hash_map/gcc?
Hello,
I'm trying to compile the ctemplate package from google and I've run
into an issue with gcc
g++ version: gcc version 4.2.3 Ubuntu 4.2.3-2ubuntu7)
The problem:
google/template_modifiers.h:289: error: 'hash_compare' was not
declared in this scope
google/template_modifiers.h:289: error: template argument 3 is invalid
The line in error is this one:
typedef __gnu_cxx::hash_map<const char*, const void*,
hash_compare<const char*>, DataEq>
DataMap;
hash_compare isn't declared in either of these
#include <ext/hash_set>
#include <ext/hash_map>
here's a code excerpt:
#ifdef WIN32
struct DataHash {
size_t operator()(const char* s1) const {
return stdext::hash_compare<const char*>()(s1);
}
bool operator()(const char* s1, const char* s2) const { // less-
than
return (s2 == 0 ? false : s1 == 0 ? true : strcmp(s1, s2) < 0);
}
// These two public members are required by msvc. 4 and 8 are
defaults.
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
};
typedef stdext::hash_map<const char*, const void*, DataHash>
DataMap;
#else
struct DataEq {
bool operator()(const char* s1, const char* s2) const {
return ((s1 == 0 && s2 == 0) ||
(s1 && s2 && *s1 == *s2 && strcmp(s1, s2) == 0));
}
};
typedef __gnu_cxx::hash_map<const char*, const void*,
hash_compare<const char*>, DataEq>
DataMap;
#endif
hash_compare is part of the hash code that the author's compiler has
and that I evidently don't.
Is this code somewhere I didn't look?
Can I get that code somewhere?
Thanks for your help!
Jay (please direct too so I don't miss your message)
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]