本文整理汇总了C++中SmallVector::index方法的典型用法代码示例。如果您正苦于以下问题:C++ SmallVector::index方法的具体用法?C++ SmallVector::index怎么用?C++ SmallVector::index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmallVector
的用法示例。
在下文中一共展示了SmallVector::index方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: diffStreamDirectory
Error DiffStyle::diffStreamDirectory() {
DiffPrinter D(2, "Stream Directory", 30, 20, opts::diff::PrintResultColumn,
opts::diff::PrintValueColumns, outs());
D.printExplicit("File", DiffResult::UNSPECIFIED,
truncateStringFront(File1.getFilePath(), 18),
truncateStringFront(File2.getFilePath(), 18));
SmallVector<StreamInfo, 32> P;
SmallVector<StreamInfo, 32> Q;
discoverStreamPurposes(File1, P);
discoverStreamPurposes(File2, Q);
D.print("Stream Count", File1.getNumStreams(), File2.getNumStreams());
auto PI = to_vector<32>(enumerate(P));
auto QI = to_vector<32>(enumerate(Q));
// Scan all streams in the left hand side, looking for ones that are also
// in the right. Each time we find one, remove it. When we're done, Q
// should contain all the streams that are in the right but not in the left.
StreamPurposeProvider StreamProvider(28);
for (const auto &P : PI) {
typedef decltype(PI) ContainerType;
typedef typename ContainerType::value_type value_type;
auto Iter = llvm::find_if(QI, [P, &StreamProvider](const value_type &V) {
DiffResult Result = StreamProvider.compare(P.value(), V.value());
return Result == DiffResult::EQUIVALENT ||
Result == DiffResult::IDENTICAL;
});
if (Iter == QI.end()) {
D.printExplicit(StreamProvider.format(P.value(), false),
DiffResult::DIFFERENT, P.index(), "(not present)");
continue;
}
D.print<EquivalentDiffProvider>(StreamProvider.format(P.value(), false),
P.index(), Iter->index());
QI.erase(Iter);
}
for (const auto &Q : QI) {
D.printExplicit(StreamProvider.format(Q.value(), true),
DiffResult::DIFFERENT, "(not present)", Q.index());
}
return Error::success();
}