关于LIst的使用
class Pair{
public:
int small;
int big;
void insPairList(Pair);
}
void Pair::insPairList(Pair pair) {
list<Pair>::iterator plbegin = pairList.begin();
list<Pair>::iterator plend = pairList.end();
if (pair.small <= (*plbegin).small) {
// 在开始位置插入碰撞对
pairList.push_front(pair);
}
else if (pair.small > (*plend).small) {
// 在末尾插入碰撞对
pairList.push_back(pair);
}
}
上面程序错在哪了?编译能够通过,但是运行的时候老是出现错误