什么是类型为"System.Runtime.InteropServices.SEHException"的未处理异常
What is an unhandled exception of type 'System.Runtime.InteropServices.SEHException'
当我编译这个时,它给了我这个消息:
类型为"System.Runtime.InteropServices"的未处理异常。SEHException' occurred in Unknown Module.
附加信息:外部组件抛出异常。
谁能解释一下这是什么意思?我很确定代码是正确的。谢谢。
#include <string>
#include <iostream>
#include <cassert>
using namespace std;
class List;
class Iterator;
class Node
{
public:
/*
Constructs a node with a given data balue.
@param s the data to store in this node
**/
Node(string s);
private:
string data;
Node* previous;
Node* next;
friend class List;
friend class Iterator;
};
class List
{
public:
/**
Constructs an empty list.
**/
List();
/**
Appends an elemetn to the list.
@param data the value to append
**/
void push_back(string data);
/**
Inserts an elemtn into the list.
@param iter the postion before which to insert
@param s the value to append
**/
void insert(Iterator iter, string s);
/**
Removes an elemtn from the list.
@param iter the postion to remove
@param return an iterator pointing to the elemtn after the erased elemtn
**/
Iterator erase(Iterator iter);
/**
Gets the beginning position of the list.
@return an ietartor pointing to the beginning of the list
**/
Iterator begin();
/**
Gets the past-the-end position of the list.
@return an iterator pointing past the end of thel ist
**/
Iterator end();
private:
Node* first;
Node* last;
friend class Iterator;
};
class Iterator
{
public:
/**
Constructs an iterator that does not point into any list.
**/
Iterator();
/**
Looks up the value at a position.
@return the value of the node to which the iterator pionts
**/
string get() const;
/**
Advances the iterator to the next node.
**/
void next();
/**
Moves the iterator to the previous node.
**/
void previous();
/**
Compares two iterators.
@param b the iterator to compare with this iterator
@return true if this iterator and b are equal
**/
bool equals(Iterator b) const;
private:
Node* position;
List* container;
friend class List;
};
Node::Node(string s)
{
data = s;
previous= NULL;
next = NULL;
}
List::List()
{
first = NULL;
last = NULL;
}
void List::push_back(string data)
{
Node* new_node = new Node(data);
if (last == NULL) // List is empty
{
first = new_node;
last = new_node;
}
else
{
new_node->previous = last;
last->next = new_node;
last = new_node;
}
}
void List::insert(Iterator iter, string s)
{
if (iter.position == NULL)
{
push_back(s);
return;
}
Node* after = iter.position;
Node* before = after->previous;
Node* new_node = new Node(s);
new_node->previous = before;
new_node->next = after;
after->previous = new_node;
if (before == NULL) // INSERT AT BEGINNING
first = new_node;
else
before->next = new_node;
}
Iterator List::erase(Iterator iter)
{
assert(iter.position != NULL);
Node* remove = iter.position;
Node* before = remove->previous;
Node* after = remove->next;
if (remove == last)
last = before;
else
after->previous = before;
delete remove;
Iterator r;
r.position = after;
r.container = this;
return r;
}
Iterator List::begin()
{
Iterator iter;
iter.position = first;
iter.position = first;
iter.container = this;
return iter;
}
Iterator List::end()
{
Iterator iter;
iter.position = NULL;
iter.container = this;
return iter;
}
Iterator::Iterator()
{
position = NULL;
container = NULL;
}
string Iterator::get() const
{
assert(position != NULL);
return position->data;
}
void Iterator::next()
{
assert(position != NULL);
position = position->next;
}
void Iterator::previous()
{
assert(position != container->first);
if (position == NULL)
position = container->last;
else
position = position->previous;
}
bool Iterator::equals(Iterator b) const
{
return position == b.position;
}
int main()
{
List staff;
staff.push_back("Tom");
staff.push_back("Dick");
staff.push_back("Harry");
staff.push_back("Juliet");
// Add a value in fourth place
Iterator pos;
pos = staff.begin();
pos.next();
pos.next();
pos.next();
staff.insert(pos, "Romeo");
// Remove the staff in the 2nd place.
pos = staff.begin();
pos.next();
staff.erase(pos);
//Print all values
for (pos = staff.begin(); !pos.equals(staff.end()); pos.next())
cout << pos.get() << "n";
system("pause");
return 0;
}
在擦除功能中需要此位:
if (remove == first)
first = after;
else
before->next = after;
相关文章:
- 为什么g++在未执行的代码处标记强制转换错误
- 在 ******.exe 中0x00000000772CA267 (ntdll.dll) 处未处理的异常:0xC0000
- 在 Hello World.exe 中0x0F828F0E (ucrtbased.dll) 处未处理的异常: 0xC00
- ***读取位置*******的访问冲突处出现未处理的异常
- 分配内存后,构造函数处出现未捕获的异常
- OpenGL 和 GLUT 中0x009f240e处未处理的异常 - 101.exe:0xC0000005:访问违规写入
- 提升::系统::error_category处未解析的外部符号
- 未绘制每个顶点处的C++OpenGL颜色
- CPP_TEST.exe中0x7604c128处未处理的异常:0xC00000FD:堆栈溢出
- Quick.exe中0x003714e9处未处理的异常:0xC00000FD:堆栈溢出
- opengl错误:GLTest.exe中0x0251D09F(ig4dev32.dll)处未处理的异常:0xC00000
- 0x00363A09处出现未处理的异常,堆栈cookie检测代码检测到基于堆栈的缓冲区溢出
- 位置处未处理的异常:内存位置处的Microsoft C++异常:std::length_error
- 0x5DF9CCC8处出现未处理的异常
- Sample.exe中0x7537812f处未处理的异常:0xC0020001:字符串绑定无效
- GLut.h/osfinfo.c/dbgheap.c/mlock.c中0x76fe15de处出现未处理的异常
- SFML(32位VS12)-SFML.exe中0x701ADEF8(msvcr110.dll)处未处理的异常:0xC00
- 0xC0000005中0x770115de处未处理的异常:使用递归矢量搜索读取位置0xccccccc0时发生访问冲突
- (内存地址)(msvcr110.dll)处出现未处理的异常
- OpenCV 代码中'System.Runtime.InteropServices.SEHException'未处理的异常