Question

Trying to make a map with strings as the key and a custom class Link as the stored value, but keep getting the error in the title. Here's what I have:

typedef std::map<std::string, Link>  MY_MAP;

And the Link class:

class Link{

typedef  std::map<std::string, Link>  map_type;

public:
Link(){ next = NULL; val = 0; };
~Link(){ delete next; };
std::string key;
int val;
map_type* next;
}

Any ideas? Thanks!

Was it helpful?

Solution

Your Link class definition should end with a semicolon after the last curly bracket.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top