Set collection.
More...
#include <base/collection/Set.h>
Inherits Collection.
template<class KEY>
class Set< KEY >
Set collection.
Set collection implemented using an ordered binary tree.
- Version
- 1.1
- Examples
- testsuite/Set.cpp.
◆ Enumerator
◆ ReadEnumerator
Non-modifying enumerator.
◆ Set() [1/2]
Initializes an empty set.
◆ Set() [2/2]
Initializes set from other set.
◆ add()
template<class KEY >
const KEY* Set< KEY >::add |
( |
const KEY & |
key | ) |
|
|
inline |
Adds the specified key to the set.
- Parameters
-
key | The key to be added to the set. |
◆ find()
template<class KEY >
const KEY* Set< KEY >::find |
( |
const KEY & |
key | ) |
const |
|
inlinenoexcept |
Returns the key for the specified key. This makes sense when you need the actual state of the key which might not be used for comparison.
- Parameters
-
- Returns
- nullptr is key doesn't exist.
◆ getEnumerator()
Returns a modifying enumerator of the ordered binary tree.
◆ getReadEnumerator()
Returns a non-modifying enumerator of the ordered binary tree.
◆ getSize()
template<class KEY >
MemorySize Set< KEY >::getSize |
( |
| ) |
const |
|
inlinenoexcept |
Returns the number of elements in the collection.
◆ hasKey()
template<class KEY >
bool Set< KEY >::hasKey |
( |
const KEY & |
key | ) |
const |
|
inlinenoexcept |
Returns true if the specified key is present is this set.
- Parameters
-
key | The value to search for. |
◆ isEmpty()
template<class KEY >
bool Set< KEY >::isEmpty |
( |
| ) |
const |
|
inlinenoexcept |
Returns true if the collection is empty.
◆ operator<<() [1/2]
template<class KEY >
Set& Set< KEY >::operator<< |
( |
const KEY & |
key | ) |
|
|
inline |
◆ operator<<() [2/2]
template<class KEY >
Set& Set< KEY >::operator<< |
( |
KEY && |
key | ) |
|
|
inline |
◆ operator[]()
template<class KEY >
const KEY& Set< KEY >::operator[] |
( |
const KEY & |
key | ) |
const |
|
inline |
Returns the key for the specified key. Makes sense when you need to use the key as a reference.
◆ remove()
template<class KEY >
void Set< KEY >::remove |
( |
const KEY & |
key | ) |
|
|
inline |
Removes the specified key from this set. Raises InvalidNode if the key doesn't exist in the set.
- Parameters
-
key | The value to be removed from the set. |
◆ removeAll()
template<class KEY >
void Set< KEY >::removeAll |
( |
| ) |
|
|
inlinenoexcept |
Removes all the keys from this set.
◆ operator<<()
Writes a string representation of a set to a format stream.