Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T constraints.Ordered] struct { // contains filtered or unexported fields }
Set is a minimal set that takes only ordered types: any type that supports the operators < <= >= >.
func From ¶
func From[T constraints.Ordered](elements ...T) *Set[T]
From returns a set from elements.
func New ¶
func New[T constraints.Ordered](size int) *Set[T]
New returns an empty set with capacity size. The capacity will grow and shrink as a stdlib map.
func (*Set[T]) Difference ¶
Difference returns a set containing the elements of s that are not in x.
func (*Set[T]) OrderedList ¶
func (s *Set[T]) OrderedList() []T
OrderedList returns a slice of the elements of s, ordered. TODO This can probably be replaced in Go 1.20 when a generics slice packages reaches the stdlib.
Click to show internal directories.
Click to hide internal directories.