本文整理汇总了C++中Ordered_list::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Ordered_list::clear方法的具体用法?C++ Ordered_list::clear怎么用?C++ Ordered_list::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ordered_list
的用法示例。
在下文中一共展示了Ordered_list::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clear_Catalog
// This clears the contents of the catalog.
void clear_Catalog(Ordered_list<Collection> &catalog)
{
num_Collections = 0;
catalog.clear();
cout << "All collections deleted" << endl;
return;
}
示例2: clear_Library
// This clears the contents of the current library. An error occurs if
// there is a collection with one or more members.
void clear_Library(Ordered_list<Record *> &library_by_title, Ordered_list<Record *> &library_by_ID, const Ordered_list<Collection> &catalog)
{
Ordered_list<Collection>::Iterator it = catalog.begin();
while (it != catalog.end())
{
if (!it -> empty())
{
throw Error("Cannot clear all records unless all collections are empty!");
}
++it;
}
empty_record_list(library_by_title);
// We've already called the destructors for the pointers to records
// so now we just need to clear the other list
library_by_ID.clear();
num_Records = 0;
cout << "All records deleted" << endl;
return;
}