Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to define non inline methods of the template class
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tzieleniewski




PostPosted: 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
Sponsor
sponsor
wtd




PostPosted: 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
bugzpodder




PostPosted: Mon Nov 20, 2006 7:38 am   Post subject: (No subject)

wrap your class around the std implementation of hashmap Smile
OneOffDriveByPoster




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: