A XMultiAutoSkipList
acts like a combination of a multiset
and vector
in functionality though the performance requirements are different in a few places. It can be accessed by key or numerical index. The index is the automatically calculated position in the sorted list.
A XMultiAutoSkipList
uses a Random Access Iterator LOGN. See XMultiAutoSkipList::T0 for more info.
A XMultiAutoSkipList
is a Simple Associative Container, meaning that its value type, as well as its key type, is T
.
It is a Random Access Container LOGN, meaning that an element may be numerically indexed in logarithmic time. Erase and Destroy may also be done by numerical index in logarithmic time.
It is a Multiple Sorted Associative Container, meaning that two or more elements may be identical.
It is a Associative Container LOGN, meaning that erasing of a single element is logarithmic.
It is a Destructive Associative Container LOGN, meaning that destroying (delete folowed by erase) single element or a range of elements is done in logarithmic time.
It is both a Front Access Container and a Back Access Container meaning that the front and back of the list are available for retrieval, erasure and destruction in constant time.
The Unique Sorted Associative Container and Multiple Sorted Associative Container requirements guarantee that inserting a range takes only linear time if the range is already sorted. Unfortunately, this has not been implemented yet and performs in the default nlogn time.
XMultiAutoSkipList
iterators have an additional property that contains the index of the element. Erasing or inserting an element that comes after an existing iterator will have that iterator remain valid. All other iterators will have some functionality that will no longer work until the iterator is revalidated by invoking refresh(). refresh() may be called at any point in the future as long as the element pointed to by the iterator continues to exist in the container.
Here are operations that are always valid on XMultiAutoSkipList
iterators.
All other operations require refresh() including all operations via the container requiring an iterator. It is recommended to not rely on the above list of functionality and simply invoke refresh() on existing iterators after inserting or deleting an element. Only Equality Comparable comparisons and dereferencing are guaranteed to be compatible with future versions.
Defined in the custom header "CSCompositeSkipList.h".
Parameter | Description | Default |
---|---|---|
X | The XMultiAutoSkipList 's index within the composite container of type XBidiCompositeSkipList. | |
CT | The custom composite container class. | |
Pr | The key comparison function, a Strict Weak Ordering whose argument type is key_type ; it returns true if its first argument is less than its second argument, and false otherwise. This is also defined as XMultiAutoSkipList::key_compare and XMultiAutoSkipList::value_compare . | less<T> |
Random Access Container LOGN, Simple Associative Container, Multiple Sorted Associative Container, Associative Container LOGN, Destructive Associative Container LOGN, Front Access Container and Back Access Container
CT
is derived from XBidiCompositeSkipList. Pr
is a Strict Weak Ordering whose argument type is T
. None.
Member | Where defined | Performance | Description |
---|---|---|---|
value_type | Container | The type of object, T, stored in the XMultiAutoSkipList . T is CT::value_type. | |
key_type | Associative Container LOGN | The key type, T, associated with value_type. | |
key_compare | Sorted Associative Container | Function object that compares two keys for ordering. | |
value_compare | Sorted Associative Container | Function object that compares two values for ordering. | |
container_type | XMultiAutoSkipList | Type of this container | |
pointer | Container | Pointer to T . | |
reference | Container | Reference to T | |
const_reference | Container | Const reference to T | |
mapped_type | Simple Associative Container | A type identical to value_type and T | |
mapped_type_reference | Simple Associative Container | A type identical to reference | |
const_mapped_type | Simple Associative Container | A type identical to const value_type | |
const_mapped_type_reference | Simple Associative Container | A type identical to const reference | |
size_type | Container | An unsigned integral type. | |
difference_type | Container | A signed integral type. | |
iterator | Container | Iterator used to iterate through the container's elements. [1] | |
const_iterator | Container | Const iterator used to iterate through the container's elements. | |
reverse_iterator | Reversible Container | Iterator used to iterate backwards through the container's elements. [1] | |
const_reverse_iterator | Reversible Container | Const iterator used to iterate backwards through the container's elements. | |
slpair | XMultiAutoSkipList | std::pair< iterator, bool > | |
iterator begin() | Container | O(1) | Returns an iterator pointing to the beginning of the container. |
iterator end() | Container | O(1) | Returns an iterator pointing to the end of the container. |
const_iterator begin() const | Container | O(1) | Returns a const_iterator pointing to the beginning of the container. |
const_iterator end() const | Container | O(1) | Returns a const_iterator pointing to the end of the container. |
reverse_iterator rbegin() | Reversible Container | O(1) | Returns a reverse_iterator pointing to the beginning of the reversed container. |
reverse_iterator rend() | Reversible Container | O(1) | Returns a reverse_iterator pointing to the end of the reversed container. |
const_reverse_iterator rbegin() const | Reversible Container | O(1) | Returns a const_reverse_iterator pointing to the beginning of the reversed container. |
const_reverse_iterator rend() const | Reversible Container | O(1) | Returns a const_reverse_iterator pointing to the end of the reversed container. |
size_type size() const | Container | O(1) | Returns the size of the container. |
size_type max_size() const | Container | O(1) | Returns the largest possible size of the container. |
bool empty() const | Container | O(1) | true if the container's size is 0 . |
key_compare key_comp() const | Sorted Associative Container | O(1) | Returns the key_compare object used by the container. |
value_compare value_comp() const | Sorted Associative Container | O(1) | Returns the value_compare object used by the container. |
XMultiAutoSkipList() | Container | O(1) | Creates an empty container. Default probability of 25% and 8 levels. |
XMultiAutoSkipList(const key_compare &comp) | Sorted Associative Container | O(1) | Creates an empty container, using comp as the key_compare object. |
~XMultiAutoSkipList() | Container | O(n) | Destructor. Clears list. |
container_type& | Container | O(m*n*logn) | The assignment operator. |
void swap(container_type &right) | Container | O(m*n*logn) | Swaps the contents of two containers. |
template<class InIt > | XMultiAutoSkipList | O(m*n*logn) | Clears all elements and copies range into container. |
void insert(node_type *node) | XIndexedSkipList | O(1C) | Adds node to end of list. |
void erase(node_type *node) | XIndexedSkipList | O(1C) | Erases the specified node. |
iterator insert(const value_type &val) | Multiple Associative Container | O(m*logn) | Inserts val into the container. |
iterator insert(const iterator &where, | Multiple Sorted Associative Container | O(m*logn) | DO NOT USE THIS!!! Inserts val into the container,using where as a hint to where it will be inserted. |
template<class InIt > | Multiple Sorted Associative Container | O(m*n*logn) | Inserts a range into the container. Should be fixed to support O(n) when range is sorted. |
iterator erase(const iterator &where) | Associative Container LOGN | O(m*logn) | Erases the element pointed to by where . |
iterator destroy(const iterator &where) | Destructive Associative Container LOGN | O(m*logn) | Erases and deletes the element pointed to by where . |
size_type erase(const key_type &keyval) | Associative Container LOGN | O(m*logn) | Erases the element whose key is keyval . |
size_type destroy(const key_type &keyval) | Destructive Associative Container LOGN | O(m*logn) | Erases and deletes the element whose key is keyval . |
iterator erase(const iterator &first, const iterator &last) | Associative Container LOGN | O(m*n*logn) | Erases all elements in a range. |
iterator destroy(const iterator &first, const iterator &last) | Destructive Associative Container LOGN | O(m*n*logn) | Erases and deletes all elements in a range. |
void clear() | Associative Container LOGN | O(m+n) | Erases all of the elements. |
void destroy() | Destructive Associative Container LOGN | O(m+n) | Erases and deletes all of the elements. |
iterator erase_index(size_type index) | XMultiAutoSkipList | O(m*logn) | Erases the element at the specified index. |
iterator destroy_index(size_type index) | XMultiAutoSkipList | O(m*logn) | Deletes and erases the element at the specified index. |
template<class Pr1 > | XMultiAutoSkipList | O(m*n*logn) | Erases all elements where pred(*where) is true. |
template<class Pr4 > | XMultiAutoSkipList | O(m*n*logn) | Destroys all elements where pred(*where) is true. |
reference front() | Front Access Container | O(1) | Returns the first element. |
const_reference front() const | Front Access Container | O(1) | Returns the first element. |
reference back() | Back Access Container | O(1) | Returns the last element. |
const_reference back() const | Back Access Container | O(1) | Returns the last element. |
void pop_front() | Front Access Container | O(m*logn) | Removes the first element. |
void destroy_front() | Front Access Container | O(m*logn) | Removes and deletes the first pointer element. |
void pop_back() | Back Access Container | O(m*logn) | Removes the last element. |
void destroy_back() | Back Access Container | O(m*logn) | Removes and deletes the last pointer element. |
iterator find(const key_type &keyval) | Associative Container LOGN | O(logn) | Finds an element whose key is keyval . |
const_iterator find(const key_type &keyval) const | Associative Container LOGN | O(logn) | Finds an element whose key is keyval . |
size_type count(const key_type &keyval) const | Multiple Associative Container | O(logn) | Counts the number of elements whose key is keyval (0 or 1). |
iterator lower_bound(const key_type &keyval) | Sorted Associative Container | O(logn) | Finds the first element whose key is not less than keyval . |
const_iterator lower_bound(const key_type &keyval) const | Sorted Associative Container | O(logn) | Finds the first element whose key is not less than keyval . |
iterator upper_bound(const key_type &keyval) | Sorted Associative Container | O(logn) | Finds the first element whose key greater than keyval . |
const_iterator upper_bound(const key_type &keyval) const | Sorted Associative Container | O(logn) | Finds the first element whose key greater than keyval . |
std::pair< iterator, iterator > | Sorted Associative Container | O(logn) | Finds a range containing all elements whose key is keyval . |
std::pair< const_iterator, const_iterator > | Sorted Associative Container | O(logn) | Finds a range containing all elements whose key is keyval . |
mapped_type_reference | Random Access Container LOGN | O(logn) | Returns a reference to the element located at the specified index. |
const_mapped_type_reference | Random Access Container LOGN | O(logn) | Returns a reference to the element located at the specified index. |
mapped_type_reference at(size_type off) | Random Access Container LOGN | O(logn) | Returns a reference to the element located at the specified index. |
const_mapped_type_reference at(size_type off) const | Random Access Container LOGN | O(logn) | Returns a reference to the element located at the specified index. |
bool operator==(const container&, | Forward Container | O(n) | Tests two maps for equality. This is a global function, not a member function. |
bool operator<(const container&, | Forward Container | O(n) | Lexicographical comparison. This is a global function, not a member function. |
[1] XMultiAutoSkipList::iterator
is not a mutable iterator, because XMultiAutoSkipList::value_type
is not Assignable. That is, if i
is of type XMultiAutoSkipList::iterator
and p
is of type XMultiAutoSkipList::value_type
, then *i = p
is not a valid expression. However, XMultiAutoSkipList::iterator
isn't a constant iterator either, because it can be used to modify the object that it points to for members that aren't used as part of the key. Using the same notation as above, i->member = p
is a valid expression, but care must be taken to retain all original values related to the key in order to keep the list sorted. The same point applies to XMultiAutoSkipList::reverse_iterator
.
XBidiCompositeSkipList, XAutoSkipList, XIndexedSkipList, MultiAutoSkipList, Container, Iterator Overview, Random Access Iterator LOGN, Random Access Container LOGN Simple Associative Container, Unique Sorted Associative Container, Multiple Sorted Associative Container, Associative Container, Associative Container LOGN, Sorted Associative Container, Destructive Associative Container LOGN, Pair Associative Container, Reversible Container, Reversible Container LOGN, Front Access Container, Back Access Container and Back Access Container LOGN