I've been working with templated classes for years now...but we all have our brain farts, dont we? So...I was simply building a key-value map class, using a binary search tree as my backbone for the class.
Anyways, I am receiving some odd errors when I try to compile...and after doing an examination of my code I don't know what is wrong. The errors are as follows:
1. MAP_DTP is not a template type (line 8)
2. MAP_DTP is not a template (line 21)
The are more...but the basically follow the same pattern as those first 3. There is actually one more that I find quite funny. I will post it as comic relief:
3. confused by earlier errors, bailing out
haha...i love that...i made the computer confused.
Anyways...the code for the class declaration itself is quite short, so I shall post it:
Code:
#ifndef __MAP_DTP_H
#define __MAP_DTP_H
#include "BST.h" //where BST is contained
#include "sort240.h" //where simpleVector is contained
template <class TKey, class TValue>
class MAP_DTP
{
protected:
//The actual binary-search-tree containing the keys and values
BST myTreeMap;
void OutputMap ( ostream & output, BSTNode *root );
public:
//Constructors
MAP_DTP ( );
MAP_DTP ( const MAP_DTP<TKey, TValue> & otherMap );
//Destructors
~MAP_DTP ( );
//Accessors
bool ContainsKey ( TKey myKey );
bool ConstainsValue ( TValue myValue );
bool IsEmpty ( void );
int Size ( void );
TValue & GetValue ( TKey myKey );
simpleVector <TKey> GetKeys ( void );
simpleVector <TValue> GetValues ( void );
void Test ( ostream & output );
//Modifiers
void Clear ( void );
bool SetValue ( TKey myKey, TValue myValue );
bool RemoveKey ( TKey myKey );
//Operators
TValue & operator [] ( const TKey & index );
bool operator == ( const MAP_DTP<TKey, TValue> & rhs );
MAP_DTP<TKey, TValue> & operator = ( const MAP_DTP<TKey, TValue> & rhs );
};
#endif /* __MAP_DTP_H */
Do you guys see anything that might be wrong in my syntax or logic? Thanks for any help.