Unordered Array Set
Class of objects that store a sequence of values as a Lua array like class UnorderedArray. However it additionally maps values to its current position in the array allowing efficient containment checks and location of a value in the array for removal. This class is useful when it is necessary to store a set elements (no duplicates) as an array (e.g. to comply with some library API) but such elements are removed and inserted frequently or it is necessary to perform quick containment checks.
Behaves like UnorderedArray class but provides operations to check containment, get the array position, or remove any element of the collection.
valueto the collection if it was not already inserted and returns
valuewas already in the collection then the call has no effect and returns no value.
Return true if a
valuebelongs to the collection or false otherwise.
Returns the index where value is stored in the array part of the collection or returns
valuedoes not belong to the collection. This operation has the same effect of doing
valuebelongs to the collection then it is removed from it and is then returned by this function. Otherwise this function has no effect and no values are returned.
Removes the element at position
indexof the array and returns the removed element. Otherwise this function has no effect and no values are returned. If
indexis out of the array bounds then the call has no effect and no values are returned.
Returns the value at
indexof the array part of the collection. This operation has the same effect of doing
-- example missing