Hi, I am trying to create a wrapper class for hash_sets. I would like to use templates for the type of data that is stored in the hash_set, but I get a strange compiler error. Everything works, if I don't use templates. But with templates I get with g++ 4.1.2:
../TWTHashSet.h:42: error: type '__gnu_cxx::hash_set<PointerTemplate*, CTWTHashSet<PointerTemplate>::pointerHashFunction, CTWTHashSet<PointerTemplate>::pointerEquality, std::allocator<PointerTemplate*> >' is not derived from type 'CTWTHashSet<PointerTemplate>' ../TWTHashSet.h:42: error: expected ';' before 'hash_setIterator' I do not understand the error message. Could someone explain, what I am doing wrong, or how I can solve that problem? Thank you very much, Benjamin Bihler Source code: TWTHashSet.cpp: #include "TWTHashSet.h" template< class PointerTemplate > CTWTHashSet< PointerTemplate >::CTWTHashSet() { } template< class PointerTemplate > CTWTHashSet< PointerTemplate >::~CTWTHashSet() {} TWTHashSet.h: #ifndef TWTHASHSET_H_ #define TWTHASHSET_H_ #include <ext/hash_set> template< class PointerTemplate > class CTWTHashSet { public: CTWTHashSet(); ~CTWTHashSet(); class pointerEquality; class pointerHashFunction; class pointerEquality { public: bool operator()(const PointerTemplate *s1, const PointerTemplate *s2) const { return (s1 == s2); } }; class pointerHashFunction { public: size_t operator()(const PointerTemplate *__x) const { return ( size_t )__x; } }; __gnu_cxx::hash_set< PointerTemplate*, pointerHashFunction, pointerEquality, std::allocator< PointerTemplate* > > hsDreieckSet; __gnu_cxx::hash_set< PointerTemplate*, pointerHashFunction, pointerEquality, std::allocator< PointerTemplate* > >::iterator hash_setIterator; }; #endif /*TWTHASHSET_H_*/ _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus