HashSet<K>

class HashSet<K: copyable>

A hash-based set of unique keys.

Remarks

HashSet owns shallow copies of its keys. Pointer and string keys copy the pointer value; the supplied hash policy controls identity or content comparison.

Lifecycle members

constructor

Initializes an empty set with a hash policy and remembers the allocator used for storage.

destructor

Releases all allocated storage.

Instance members

bool

Adds a key and returns true when the key was not already present.

void

Removes all keys and optionally releases storage.

bool

Returns true when the key is present.

escaped K[]

Allocates a new array containing all keys in unspecified order.

nuint

Returns the number of key slots currently allocated.

nuint
getLength()
property

Returns the number of keys in the set.

bool

Removes a key and returns true when an item was removed.

Generated with campc v0.4.0-preview.1+d50446ef951a6ed675f7086cf093dbc993f0041b.