本文整理汇总了C++中DList::removeBack方法的典型用法代码示例。如果您正苦于以下问题:C++ DList::removeBack方法的具体用法?C++ DList::removeBack怎么用?C++ DList::removeBack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DList
的用法示例。
在下文中一共展示了DList::removeBack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
DList <int> *list = new DList<int>();
int a = 34;
int b = 35;
int c = 36;
int d = 37;
int e = 38;
list->insertOrdered(&c);
list->insertOrdered(&e);
list->insertOrdered(&b);
list->insertOrdered(&d);
list->insertOrdered(&a);
list->printList();
cout << "First: " << *list->removeFront() << endl;
cout << "Last: " << *list->removeBack() << endl;
list->findDelete(&c);
cout << "Remove Middle element" << endl;
list->printList();
cout << "Test removeFront()" << endl;
list->removeFront();//two elements left
list->removeFront();//one element left
list->removeFront();//zero elements left
cout << "removeFront() passed" << endl;
list->insertBack(&a);
list->insertBack(&b);
cout << "Test removeBack()" << endl;
list->removeBack();//two elements left
list->removeBack();//one element left
list->removeBack();//zero elements left
cout << "removeBack() passed" << endl;
cout << "Add all objects in order:" << endl;
list->insertOrdered(&c);//36
list->insertOrdered(&e);//38
list->insertOrdered(&a);//34
list->insertOrdered(&d);//37
list->insertOrdered(&b);//35
list->printList();
cout << "Destructor test" << endl;
delete list;
list = NULL;
cout << "All tests passed!" << endl;
return 0;
}