Closed LeoNavel closed 3 months ago
_BTree.removeFirst(_:) and _BTree.removeLast(_:) contains following incorrect assert:
_BTree.removeFirst(_:)
_BTree.removeLast(_:)
assert(0 <= k && k < self.count, "Can't remove more items from a collection than it contains")
This assertion will cause a crash (in debug mode) when we call one of these functions with the same number of items as the collection contains.
This PR solves this issue by replacing k < self.count with k <= self.count in the assert.
k < self.count
k <= self.count
@swift-ci test
_BTree.removeFirst(_:)
and_BTree.removeLast(_:)
contains following incorrect assert:This assertion will cause a crash (in debug mode) when we call one of these functions with the same number of items as the collection contains.
This PR solves this issue by replacing
k < self.count
withk <= self.count
in the assert.Checklist
I've added benchmarks covering new functionality (if appropriate).