Your Link class definition should end with a semicolon after the last curly bracket.
invalid declarator before ‘MY_MAP’
-
26-06-2023 - |
Pregunta
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!
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow