Reputation: 4178
I am trying to define a class
class BTree
{
private:
map<std::string,BTree*> *node;
public:
BTree(void);
~BTree(void);
void Insert(BTree *);
};
on compiling the code the compiler gives me an error
error C2899: typename cannot be used outside a template declaration
error C2143: syntax error : missing ';' before '<'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2238: unexpected token(s) preceding ';'
error C2899: typename cannot be used outside a template declaration
I have tried to change the map to something simple like map<int,int> node
it still gives me the same error. Am I missing something ?
Upvotes: 1
Views: 855
Reputation: 754575
This is likely because you don't have the std
namespace listed in a using
. The type map
isn't in the global namespace so so map
isn't resolvable. Try the following
class BTree {
private:
std::map<std::string, BTree*> *node;
...
};
Upvotes: 4