N
newbie
Same thing g++ complains when using hash_map<>, but is happy with
map<> --I understand hahs_map is not standardized, but since the
compiler didn't complain something like 'hash_map<> not defined', I
suppose it's supported and should behave well when I used it
correctly. BUT it didn't.
Here is my code snippet:
class MyKey {
public:
virtual void foo() { return; }
...
}
class MyContainer {
public:
typedef hash_map<MyKey*, float> _elements; // (1) typedef
map<MyKey*, float> _elements;
void Add(MyKey* key, float value) { if (_elements.find(key) !=
_elements.end() ) _elements[key] = value; }
}
When I compile the above code, the compiler complains something like
prototype not matched; when I replace line(1) with 'typedef
map<MyKey*, float> _elements;', everything passed.
Can you see the problem?
thanks a lot
map<> --I understand hahs_map is not standardized, but since the
compiler didn't complain something like 'hash_map<> not defined', I
suppose it's supported and should behave well when I used it
correctly. BUT it didn't.
Here is my code snippet:
class MyKey {
public:
virtual void foo() { return; }
...
}
class MyContainer {
public:
typedef hash_map<MyKey*, float> _elements; // (1) typedef
map<MyKey*, float> _elements;
void Add(MyKey* key, float value) { if (_elements.find(key) !=
_elements.end() ) _elements[key] = value; }
}
When I compile the above code, the compiler complains something like
prototype not matched; when I replace line(1) with 'typedef
map<MyKey*, float> _elements;', everything passed.
Can you see the problem?
thanks a lot