StringSet

Binary tree implementation of a hash set with strings as elements.

Constructors

this
this(size_t nrOfNodes = 0, size_t size = 0)

Constructs a StringSet with the desired properties.

Members

Functions

add
const(cbinstr)* add(cbinstr str)

Returns an existing entry or creates a new one.

find
size_t* find(cbinstr str, hash_t hash)
size_t* find(cbinstr str)

Finds the Node holding str, or a slot where a new Node can be saved.

get
const(cbinstr)* get(cbinstr str)

Returns a reference to str if it exists.

getNode
Node* getNode(size_t nindex)

Returns the Node for the 1-based index.

has
bool has(cbinstr str)

Returns true if str is contained in the set.

newNode
size_t newNode()

Allocates and returns the 1-based index of a new uninitialized Node.

repr
cstring repr()

Returns a string representation.

resize
void resize(size_t size)

Resizes the bucket list and reassigns the nodes.

Structs

Node
struct Node

Variables

list
size_t[] list;

List of 1-based indices to Nodes.

nodes
DArray!Node nodes;

Instances of Node.

Meta