I have a simple hash table template,
template <class K, class V, long H(K)>
class HashTableAbs{/* .... */}
//where K is key type, V is value type, H gives hash code for K value
and simple inheritor class
template <class K, class V, long H(K)>
class HashTable:public HashTableAbs<K, V, H> {};
and i want to specialize this template for string, with my default hash function
template <class V>
class HashTable<std::string, V, strSimpleHash>:public HashTableAbs<std::string, V, strSimpleHash> {};
//where strSimpleHash is long strSimpleHash(std::string)
But when i trying to compile this compiler write this
test.o: In function `strSimpleHash(std::string)':
test.cpp:(.text+0x0): multiple definition of `strSimpleHash(std::string)'
/tmp/main-i7yPhc.o:main.cc:(.text+0x0): first defined here
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(test includes hashtable.h where HashTable is defined) strSimpleHash is defined only in hashtable.h
Is there way out? PS sorry for my writing mistakes. English in not my native language