Kaydet (Commit) 87003581 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

fdo#54898: Test equality by order index (integer) which is more stable.

At the point where std::unique is called, we can use order indices to
determine whether the two items are equal. This should be more stable
than using CaseInsEqual() to assess equality.

Change-Id: I88310fc7beede19fb1c629b9b7e3cb9a069b2b23
üst 4ca546de
...@@ -207,11 +207,11 @@ struct LessByDataIndex : std::binary_function<Bucket, Bucket, bool> ...@@ -207,11 +207,11 @@ struct LessByDataIndex : std::binary_function<Bucket, Bucket, bool>
} }
}; };
struct EqualByValue : std::binary_function<Bucket, Bucket, bool> struct EqualByOrderIndex : std::binary_function<Bucket, Bucket, bool>
{ {
bool operator() (const Bucket& left, const Bucket& right) const bool operator() (const Bucket& left, const Bucket& right) const
{ {
return left.maValue.IsCaseInsEqual(right.maValue); return left.mnOrderIndex == right.mnOrderIndex;
} }
}; };
...@@ -287,7 +287,7 @@ void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField) ...@@ -287,7 +287,7 @@ void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField)
// Unique by value. // Unique by value.
std::vector<Bucket>::iterator itUniqueEnd = std::vector<Bucket>::iterator itUniqueEnd =
std::unique(aBuckets.begin(), aBuckets.end(), EqualByValue()); std::unique(aBuckets.begin(), aBuckets.end(), EqualByOrderIndex());
// Copy the unique values into items. // Copy the unique values into items.
std::vector<Bucket>::iterator itBeg = aBuckets.begin(); std::vector<Bucket>::iterator itBeg = aBuckets.begin();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment