SplitUnchecked splits the given segment at the given key and returns iterators to the two resulting segments. All existing iterators (including seg, but not including the returned iterators) are invalidated. Preconditions: seg.Start() < key < seg.End().
(seg Iterator, split Key)
| 860 | // |
| 861 | // Preconditions: seg.Start() < key < seg.End(). |
| 862 | func (s *Set) SplitUnchecked(seg Iterator, split Key) (Iterator, Iterator) { |
| 863 | val1, val2 := (Functions{}).Split(seg.Range(), seg.Value(), split) |
| 864 | end2 := seg.End() |
| 865 | seg.SetEndUnchecked(split) |
| 866 | seg.SetValue(val1) |
| 867 | seg2 := s.InsertWithoutMergingUnchecked(seg.NextGap(), Range{split, end2}, val2) |
| 868 | // seg may now be invalid due to the Insert. |
| 869 | return seg2.PrevSegment(), seg2 |
| 870 | } |
| 871 | |
| 872 | // SplitBefore ensures that the given segment's start is at least start by |
| 873 | // splitting at start if necessary, and returns an updated iterator to the |
no test coverage detected