Commit 973c82a1 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 682dc8b0
...@@ -101,8 +101,9 @@ func (A *RangedKeySet) DifferenceInplace(B *RangedKeySet) { ...@@ -101,8 +101,9 @@ func (A *RangedKeySet) DifferenceInplace(B *RangedKeySet) {
defer A.verify() defer A.verify()
// XXX dumb // XXX dumb
for _, r := range B.rangev { // for _, r := range B.rangev {
if len(A.rangev) == 0 { for _, r := range B.AllRanges() {
if A.Empty() {
break break
} }
A.DelRange(r) A.DelRange(r)
...@@ -137,6 +138,11 @@ func (S *RangedKeySet) Clear() { ...@@ -137,6 +138,11 @@ func (S *RangedKeySet) Clear() {
S.m.Clear() S.m.Clear()
} }
// AllRanges // AllRanges returns slice of all key ranges in the set.
//
// TODO -> iter?
func (S *RangedKeySet) AllRanges() /*readonly*/[]KeyRange {
return []KeyRange(S.m.AllRanges())
}
// String // String
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment