本文整理汇总了C++中forward_list::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ forward_list::clear方法的具体用法?C++ forward_list::clear怎么用?C++ forward_list::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forward_list
的用法示例。
在下文中一共展示了forward_list::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IBD_hash
// input: two trees waiting to be compared, the resultpointer) repository
// output: the updated resultpointer) repository (it's a hashing table with "long int: int" pair in)
void IBD_hash(char * tree1, char * tree2, unordered_map<long int, double> * resultpointer)
{
// NOTE:
// in practice, we can store the second hashing table, and when next time we enter, we can directly use it
// we can achieve this by storing the second hashing table as global in this scope
(*resultpointer).clear();
// clean the global variables
h11.clear();
list1.clear();
list3.clear();
rubbish.clear();
parser1(tree1);
// DEBUG
/*
for(auto itr = h11[124.8].begin(); itr != h11[124.8].end(); itr ++)
{
cout << (*itr)->tMRCA << ":" << (*itr)->start << " " << (*itr)->middle << " " << (*itr)->end << " " << endl;
}
*/
parser2(tree2, resultpointer);
// empty the temporary rubbish pool
for(auto itr = rubbish.begin(); itr != rubbish.end(); itr ++)
{
free(*itr);
}
// free the h11 memory for fear that there will be memory overflow
for(auto itr = h11.begin(); itr != h11.end(); itr ++)
{
// (*itr) is a forward_list<MRCA *>
for(auto itr1 = (*itr).second.begin(); itr1 != (*itr).second.end(); itr1 ++)
{
// (*itr1) is a (MRCA *)
free(*itr1);
}
}
return;
}