bools

package
v0.0.0-...-6a307ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitset

type Bitset[V bitset.Value] struct {
	logical.IterableMixin[V]
	// contains filtered or unexported fields
}

Bitset is a boolean-slice-backed bit array. It favors speed over size.

func New

func New[V bitset.Value](size uint) *Bitset[V]

New creates a new boolean bitset with an initial size of size.

func (*Bitset[V]) And

func (a *Bitset[V]) And(b *Bitset[V]) (aAndB *Bitset[V])

func (*Bitset[V]) Cap

func (b *Bitset[V]) Cap() int

func (*Bitset[V]) Clear

func (s *Bitset[V]) Clear()

func (*Bitset[V]) Copy

func (s *Bitset[V]) Copy() *Bitset[V]

func (*Bitset[V]) Get

func (s *Bitset[V]) Get(index V) bool

Get returns whether or not a value is set in the underlying bool slice. Getting a value outside of what's stored automatically returns false.

func (*Bitset[V]) Iterate

func (s *Bitset[V]) Iterate() (iterable.Iter[V], uint)

func (*Bitset[V]) Len

func (b *Bitset[V]) Len() int

func (*Bitset[V]) Or

func (a *Bitset[V]) Or(b *Bitset[V]) (aOrB *Bitset[V])

func (*Bitset[V]) Pop

func (b *Bitset[V]) Pop() uint

func (*Bitset[V]) Set

func (s *Bitset[V]) Set(indices ...V)

Set one or more values in the bitset. The bitset will be expanded if necessary.

func (*Bitset[V]) Unset

func (s *Bitset[V]) Unset(indices ...V)

Unset one or more values in the bitset. Indices outside of range are ignored.

type Iterator

type Iterator[V bitset.Value] struct {
	Bitset[V]
	// contains filtered or unexported fields
}

func (*Iterator[V]) Next

func (it *Iterator[V]) Next() (V, bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL