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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
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. ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
bugzpodder
![](http://www.vbforums.com/avatar.php?userid=31755&dateline=1038631511)
|
Posted: Mon Nov 20, 2006 7:38 am Post subject: (No subject) |
|
|
wrap your class around the std implementation of hashmap ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
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. |
|
|
|
|
![](images/spacer.gif) |
|
|