本文整理汇总了C++中PartVector::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ PartVector::clear方法的具体用法?C++ PartVector::clear怎么用?C++ PartVector::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PartVector
的用法示例。
在下文中一共展示了PartVector::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_involved_parts
void get_involved_parts(
const PartVector & union_parts,
const Bucket & candidate,
PartVector & involved_parts
)
{
involved_parts.clear();
if (union_parts.size() == 0) {
return;
}
// Used to convert part ordinals to part pointers:
MetaData & meta_data = MetaData::get( * union_parts[0]);
const PartVector & all_parts = meta_data.get_parts();
const std::pair<const unsigned *,const unsigned *>
bucket_part_begin_end_iterators = candidate.superset_part_ordinals(); // sorted and unique
std::vector<unsigned> union_parts_ids;
copy_ids( union_parts_ids , union_parts ); // sorted and unique
std::vector<unsigned>::const_iterator union_part_id_it = union_parts_ids.begin();
const unsigned * bucket_part_id_it = bucket_part_begin_end_iterators.first ;
while ( union_part_id_it != union_parts_ids.end() &&
bucket_part_id_it != bucket_part_begin_end_iterators.second )
{
if ( *union_part_id_it < *bucket_part_id_it ) {
++union_part_id_it ;
}
else if ( *bucket_part_id_it < *union_part_id_it ) {
++bucket_part_id_it ;
}
else {
// Find every match:
Part * const part = all_parts[ *union_part_id_it ];
involved_parts.push_back( part );
++union_part_id_it;
++bucket_part_id_it;
}
}
}