mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
refs #698 Added unorderedEqualsByKeys method for sequences.
This commit is contained in:
@@ -463,6 +463,16 @@ namespace BlackMisc
|
||||
return partiallySorted(n, BlackMisc::Predicates::MemberLess(key1, keys...));
|
||||
}
|
||||
|
||||
//! Return true if this container equals another container, considering only the given element members.
|
||||
//! Order of elements is not considered; this is implemented using a transient sort, so don't overuse.
|
||||
template <class U, class Key0, class... Keys>
|
||||
bool unorderedEqualsByKeys(const U &other, Key0 k0, Keys... keys) const
|
||||
{
|
||||
if (equalPointers(this, &other)) { return true; }
|
||||
if (size() != other.size()) { return false; }
|
||||
return sorted(k0, keys...).equalsByKeys(other.sorted(k0, keys...));
|
||||
}
|
||||
|
||||
//! Split up the sequence into subsequences for which the given predicate returns the same value.
|
||||
template <class Predicate>
|
||||
auto separate(Predicate p) const -> QMap<decltype(p(std::declval<T>())), CSequence>
|
||||
|
||||
Reference in New Issue
Block a user