質問

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!

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top