How to define non inline methods of the template class
Author |
Message |
tzieleniewski
|
Posted: Sun Nov 19, 2006 4:15 pm Post subject: How to define non inline methods of the template class |
|
|
Hi All!!
Im implementing the HashMap data type class with the hash table data structure inside and i have the following template declaration in my header file:
template<class K, class V,
unsigned hashFunc(const K&),
int compFunc(const K&,const K&)=&_compFunc<K> >
class AISDIHashMap
{
...
}
I have a problem with defining non inline methods.
I try something like this but compiler thows errors:
template<class K, class V,
unsigned hashFunc(const K&),
int compFunc(const K&,const K&)=&_compFunc<K> >
AISDIHashMap<K,V,hashFunc<K>,_compFunc<K> >::clear(){...}
Please help me with the this declaration:)
Thank you for your time and any help!!
Bests
Tomek |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Sun Nov 19, 2006 4:53 pm Post subject: (No subject) |
|
|
Please post all of your code. Unless we're seeing exactly what you're seeing, we can't help you. Also, please use code tags.
One template-related tip that might help you is that templates are not executable code. They therefore cannot be separated into interface and implementation files.
I see you are new to compsci.ca. Welcome aboard. |
|
|
|
|
|
bugzpodder
|
Posted: Mon Nov 20, 2006 7:38 am Post subject: (No subject) |
|
|
wrap your class around the std implementation of hashmap |
|
|
|
|
|
OneOffDriveByPoster
|
Posted: Sat Dec 02, 2006 4:57 pm Post subject: Re: How to define non inline methods of the template class |
|
|
c++: | template<class K, class V,
unsigned hashFunc(const K&),
int compFunc(const K&,const K&)>
AISDIHashMap<K,V,hashFunc,compFunc>::clear(){...}
|
might work. |
|
|
|
|
|
|
|