如何构造结构指针映射？

``````#include<bits/stdc++.h>
using namespace std;

typedef struct trienode
{
map <char,struct trienode*> children;
bool eow;
}trienode;

void insertnode(trienode &n, string s, int i)
{
trienode* newnode = (trienode*) malloc(sizeof(trienode));
newnode->eow=0;
n.children.insert({s[i],newnode});       //The problem (occasionaly) started here.
if(s[i+1] == '\0')
{
n.children[s[i]]->eow =1;
}
else
{
insertnode(*n.children[s[i]], s, i+1);      //Here I get the error
}
}

bool search(trienode &n, string s, int i)
{
trienode* newnode = (trienode*) malloc(sizeof(trienode));
if(n.children.insert({s[i],newnode}).second) return 0;
else
{
if(n.eow) return 1;
search(*n.children[s[i]], s, i+1);
}
}

int main()
{
string sentence;
string word;
trienode root;

stringstream ss (sentence);

while(ss>>word)
{
cout<<word<<endl;
insertnode(root, word, 0);
}

word="the";
if(search(root, word, 0)) cout<<"Found!"<<endl;
}
``````

``````  template<typename _Tp>
struct less : public binary_function<_Tp, _Tp, bool>
{
_GLIBCXX14_CONSTEXPR
bool
operator()(const _Tp& __x, const _Tp& __y) const
{ return __x < __y; }                                 //HERE the fault occurs
};
``````

x值在局部值处显示正确，但不显示y的任何值。

``````    explicit constexpr pair(const pair<_U1, _U2>& __p)
: first(__p.first), second(__p.second) { }

constexpr pair(const pair&) = default;        //HERE
constexpr pair(pair&&) = default;
``````