mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
Ref T464 Implement removal of one sequence from another in O(n),
assuming that elements in both sequences are in the same order in both.
This commit is contained in:
committed by
Klaus Basan
parent
40ae7174a7
commit
71de01065b
@@ -321,6 +321,13 @@ namespace BlackMisc
|
||||
return removeIf([&other](const T &v) { return other.contains(v); });
|
||||
}
|
||||
|
||||
//! Remove all elements if they are in other
|
||||
//! \pre All elements of other must be present in the same order in this.
|
||||
void removeIfInSubset(const CSequence &other)
|
||||
{
|
||||
erase(BlackMisc::removeIfIn(begin(), end(), other.begin(), other.end()), end());
|
||||
}
|
||||
|
||||
//! Replace elements matching the given element with a replacement.
|
||||
//! \return The number of elements replaced.
|
||||
int replace(const T &original, const T &replacement)
|
||||
|
||||
Reference in New Issue
Block a user