OrderedSet
OrderedSet: OrderedSet, insert, contains, remove, lower, higher, first, last, size, empty, iterator
OrderedSetIterator: OrderedSetIterator, hasValue, value, increment
struct OrderedSet<Element>
An ordered Set that supports fast lookup, insertion and deletion.
OrderedSet
OrderedSet()Initiates an empty Set.
insert
bool insert(Element e)Inserts an element into the Set.
contains
bool contains(Element& e)Returns true if the Set contains e, otherwise false.
remove
void remove(Element& e)Removes an element from the Set, if it exists.
lower
Element&? lower(Element& e)Returns the value immediately lower than e, or
null if e is the smallest element in the
Set.
higher
Element&? higher(Element& e)Returns the value immediately higher than e, or
null if e is the largest element in the
Set.
first
Element&? first()Returns the smallest element in the Set, or null if the
Set is empty.
last
Element&? last()Returns the largest element in the Set, or null if the
Set is empty.
size
int size()Returns the size of the Set.
empty
bool empty()Returns true if the Set is empty, otherwise false.
iterator
OrderedSetIterator<Element> iterator()Iterate over the map, in order
struct OrderedSetIterator<Element>: Copyable, Iterator<Element&>
Iterates over the elements of an ordered set, in order.
OrderedSetIterator
OrderedSetIterator(OrderedSet<Element>& set)Initializes an iterator over the given set.
hasValue
bool hasValue()Returns true if there are more elements.
value
Element& value()Returns the current element.
increment
void increment()Advances to the next element.