delete报错is_block_type_valid
void book_delete(LinkList& L, int i)
{
Lib_node* p = L;
int cnt = 1;
while (p->_next && cnt < i)
{
p = p->_next;
++cnt;
}
if (cnt != i)
{
cout << "Invalid" << endl;
return;
}
if (!p->_next)
{
cout << "Invalid" << endl;
return;
}
Lib_node* q = p->_next;
p->_next = p->_next->_next;
delete q;//报错
q = NULL;
}//删除第i个结点
int main()
{
LinkList L= new Lib_node;//L指向头结点
int n;
cin >> n;
Lib_node* p = L;
for (int ix = 0; ix < n; ++ix)
{
Lib_node* q=new Lib_node;
cin >> *q;
p->_next = q;
p = q;
}//创建链表
...
}