本文整理汇总了C++中ListType::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ ListType::clear方法的具体用法?C++ ListType::clear怎么用?C++ ListType::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListType
的用法示例。
在下文中一共展示了ListType::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clearList
void Gear_UnpackList::clearList()
{
ListType *listType = _LIST_OUT->type();
for(ListType::iterator it=listType->begin(); it!=listType->end(); ++it)
delete (*it);
listType->clear();
}
示例2: addToList
void addToList(const typename ListType::value_type &data, ListType &list) const {
if (length()<=0) {
// Ensure that no dummy data will get added. Shouldn't get here.
return;
}
if (startbyte()==0 && goesToEndOfFile()) {
// favor a single chunk covering the whole file.
list.clear();
list.insert(list.end(), data);
return;
}
typename ListType::iterator endIter=list.end(), iter=list.begin();
Range::base_type startdata = startbyte();
Range::base_type maxend = startdata;
bool includeseof = false;
while (iter != endIter) {
// maxend is not relevant for ranges strictly above us.
if ((*iter).startbyte() > startdata) {
break;
}
if ((*iter).endbyte() > maxend) {
maxend = (*iter).endbyte();
}
if ((*iter).goesToEndOfFile()) {
includeseof = true;
}
// we do not want to allow for more than one
// range starting at the same start byte--
// If this is the case, one is guaranteed to overlap.
if ((*iter).startbyte() >= startdata) {
break;
}
++iter;
}
if (includeseof || (maxend > endbyte() && !goesToEndOfFile())) {
return; // already included by another range.
}
iter = list.insert(iter, data);
++iter;
while (iter != endIter) {
typename ListType::iterator nextIter = iter;
++nextIter;
if (goesToEndOfFile() ||
(!(*iter).goesToEndOfFile() && (*iter).endbyte() <= endbyte())) {
list.erase(iter);
}
iter = nextIter;
}
}
示例3: RemoveAll
inline void HapList::RemoveAll(){ haplist.clear();}