2022-05-09 09:34:08 +08:00
|
|
|
package typedRoaring
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/RoaringBitmap/roaring"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Iterator[T BitConstraint] struct {
|
2022-05-11 09:20:52 +08:00
|
|
|
roaring.IntIterator
|
2022-05-09 09:34:08 +08:00
|
|
|
}
|
|
|
|
|
2022-05-11 09:20:52 +08:00
|
|
|
func (t *Iterator[T]) Next() T {
|
|
|
|
return T(t.IntIterator.Next())
|
2022-05-09 09:34:08 +08:00
|
|
|
}
|
|
|
|
|
2022-05-11 09:20:52 +08:00
|
|
|
func (t *Iterator[T]) AdvanceIfNeeded(minVal T) {
|
|
|
|
t.IntIterator.AdvanceIfNeeded(uint32(minVal))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *Iterator[T]) Initialize(a *Bitmap[T]) {
|
|
|
|
t.IntIterator.Initialize(&a.Bitmap)
|
2022-05-09 09:34:08 +08:00
|
|
|
}
|