forked from qt-creator/qt-creator
TextEditor: Provide a function for inserting a parenthesis
... into a sorted list. Change-Id: Ibc39a345425945437cc8b8d9237589746143b2d9 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -698,4 +698,11 @@ bool Parenthesis::operator==(const Parenthesis &other) const
|
||||
return pos == other.pos && chr == other.chr && source == other.source && type == other.type;
|
||||
}
|
||||
|
||||
void insertSorted(Parentheses &list, const Parenthesis &elem)
|
||||
{
|
||||
const auto it = std::lower_bound(list.begin(), list.end(), elem,
|
||||
[](const auto &p1, const auto &p2) { return p1.pos < p2.pos; });
|
||||
list.insert(it, elem);
|
||||
}
|
||||
|
||||
} // namespace TextEditor
|
||||
|
||||
Reference in New Issue
Block a user