本文整理汇总了C++中TSet::Intersect方法的典型用法代码示例。如果您正苦于以下问题:C++ TSet::Intersect方法的具体用法?C++ TSet::Intersect怎么用?C++ TSet::Intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSet
的用法示例。
在下文中一共展示了TSet::Intersect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DiffAgainst
void FDetailsDiff::DiffAgainst(const FDetailsDiff& Newer, TArray< FSingleObjectDiffEntry > &OutDifferences) const
{
TSharedPtr< class IDetailsView > OldDetailsView = DetailsView;
TSharedPtr< class IDetailsView > NewDetailsView = Newer.DetailsView;
const auto& OldSelectedObjects = OldDetailsView->GetSelectedObjects();
const auto& NewSelectedObjects = NewDetailsView->GetSelectedObjects();
check(OldSelectedObjects.Num() == 1);
auto OldProperties = OldDetailsView->GetPropertiesInOrderDisplayed();
auto NewProperties = NewDetailsView->GetPropertiesInOrderDisplayed();
TSet<FPropertySoftPath> OldPropertiesSet;
TSet<FPropertySoftPath> NewPropertiesSet;
auto ToSet = [](const TArray<FPropertyPath>& Array, TSet<FPropertySoftPath>& OutSet)
{
for (const auto& Entry : Array)
{
OutSet.Add(FPropertySoftPath(Entry));
}
};
ToSet(OldProperties, OldPropertiesSet);
ToSet(NewProperties, NewPropertiesSet);
// detect removed properties:
auto RemovedProperties = OldPropertiesSet.Difference(NewPropertiesSet);
for (const auto& RemovedProperty : RemovedProperties)
{
// @todo: (doc) label these as removed, rather than added to a
FSingleObjectDiffEntry Entry(RemovedProperty, EPropertyDiffType::PropertyAddedToA);
OutDifferences.Push(Entry);
}
// detect added properties:
auto AddededProperties = NewPropertiesSet.Difference(OldPropertiesSet);
for (const auto& AddedProperty : AddededProperties)
{
FSingleObjectDiffEntry Entry(AddedProperty, EPropertyDiffType::PropertyAddedToB);
OutDifferences.Push(Entry);
}
// check for changed properties
auto CommonProperties = NewPropertiesSet.Intersect(OldPropertiesSet);
for (const auto& CommonProperty : CommonProperties)
{
// get value, diff:
check(NewSelectedObjects.Num() == 1);
auto OldPoperty = CommonProperty.Resolve(OldSelectedObjects[0].Get());
auto NewProperty = CommonProperty.Resolve(NewSelectedObjects[0].Get());
if (!DiffUtils::Identical(OldPoperty, NewProperty))
{
OutDifferences.Push(FSingleObjectDiffEntry(CommonProperty, EPropertyDiffType::PropertyValueChanged));
}
}
}