#ifndef TRIEAPI
#define TRIEAPI
#include <vector>
#include <string>
#include <unordered_map>
using namespace std;
typedef struct NodeStruct
{
bool validNgram = false;
unordered_map<string, struct NodeStruct> children;
struct NodeStruct* parent;
string nodeWord;
NodeStruct(struct NodeStruct* par, string w) : parent(par), nodeWord(w) {} //constructor (yeah, structs have them too)
NodeStruct() {}
}Node;
void addNgramTrie(Node* root, string ngram);
void findNgramsTrie(Node* root, string query);
void splitText(string query, vector<string> &words);
void deleteNgramTrie(Node* root, string ngram);
void recursiveParentDeletion(Node* node, Node *root);
#endif // TRIEAPI
When I try compiling the program I get an error on this header file about the pair.h (compiling in g++ 5.4 c++11):
trie.h:14:46: required from here
/usr/include/c++/5/bits/stl_pair.h:102:11: error: ‘std::pair<_T1, _T2>::second’ has incomplete type
_T2 second; /// @c second is a copy of the second object
^
In file included from trie.cpp:10:0:
trie.h:11:16: note: forward declaration of ‘struct NodeStruct’
typedef struct NodeStruct
I don't understand where I am wrong.