sincerely
Singaporean
If you have not done so, read this full tutorial on how to use SGEXTN to build an application.
(no source file, everything inside header)
template ‹typename T, typename Comparator› class SGLMultiSet;
part of SGEXTN module SG_Containers
multiset for any type of data
list of all including inherited members
preprocessor file inclusion directive: #include ‹SGLMultiSet.h›
CMake target for BuildLah: SGEXTN::SG_Containers
see this link for more information about BuildLah
parent class: (none)
children classes: (none)
SGLMultiSet();
[[nodiscard]] SGLMultiSet::Iterator begin();
[[nodiscard]] SGLMultiSet::ConstIterator constBegin() const;
[[nodiscard]] SGLMultiSet::ConstIterator constEnd() const;
[[nodiscard]] SGLMultiSet::ConstIterator constIteratorAt(int n) const;
[[nodiscard]] bool contains(const T& x) const;
[[nodiscard]] int count(const T& x) const;
[[nodiscard]] const T& elementAt(int n) const;
[[nodiscard]] SGLMultiSet::Iterator end();
bool erase(SGLMultiSet::Iterator& i);
bool erase(const T& x);
[[nodiscard]] SGLMultiSet::ConstIterator find(const T& x) const;
[[nodiscard]] SGLMultiSet::Iterator find(const T& x);
[[nodiscard]] int indexOf(const T& x) const;
[[nodiscard]] int indexOf(SGLMultiSet::ConstIterator i) const;
[[nodiscard]] int indexOf(SGLMultiSet::Iterator i) const;
void insert(const T& x);
[[nodiscard]] SGLMultiSet::Iterator iteratorAt(int n);
[[nodiscard]] int length() const;
[[nodiscard]] SGLMultiSet::ConstIterator lowerBound(const T& x) const;
[[nodiscard]] SGLMultiSet::Iterator lowerBound(const T& x);
[[nodiscard]] SGLMultiSet::Iterator upperBound(const T& x);
[[nodiscard]] SGLMultiSet::ConstIterator upperBound(const T& x) const;
SGLMultiSet provides a template based multi set that can be used with any data type. Use SGLUnorderedMultiSet if order does not matter. This is a template based class with no separate source file. This class is a SGEXTN container. Copy constructor, copy assignment, move constructor, move assignment, and destructor work as expected. A deep copy is performed whenever this class is copied, and the new instance will not be linked to the old instance in any way. It is assumed that the contents placed into this SGEXTN container can be copied and moved. This means that their copy constructor copy assignment, move constructor, move assignment, and destructor work as expected. If this is not the case or if you want the container to store references or constant references, store pointers instead.
SGLMultiSet maintains a AVL tree, which is a type of self balancing binary search tree. Most other C++ libraries use a red black tree instead. This makes SGLMultiSet slightly faster than other libraries for accessing elements but slightly slower for modifying the data structure. SGLMultiSet does not duplicate repeated elements, its underlying structure is very similar to SGLMap‹T, int, EqualityCheck, HashFunction›.
Creates an empty SGLMultiSet.
Returns a iterator to the first element in the SGLMultiSet.
SGLMultiSet iterators behave circularly. This is equivalent to running operator++ on SGLMultiSet::end.
SGLMultiSet::Iterator allows modifying the SGLMultiSet through it. If modification is not needed, use SGLMultiSet::ConstIterator instead. The SGLMultiSet::ConstIterator equivalent to this function is SGLMultiSet::constBegin.
If the SGLMultiSet is empty, this is the same as SGLMultiSet::end.
Returns a constant iterator to the first element in the SGLMultiSet.
SGLMultiSet iterators behave circularly. This is equivalent to running operator++ on SGLMultiSet::constEnd.
If the SGLMultiSet is empty, this is the same as SGLMultiSet::constEnd.
Returns a null constant iterator associated to this SGLMultiSet.
SGLMultiSet iterators behave circularly. This is equivalent to running operator-- on SGLMultiSet::constBegin.
Attempting to access the element that this iterator points to will crash.
Returns the constant iterator pointing towards the element at index n in the SGLMultiSet.
If n is out of bounds, SGLMultiSet::constEnd is returned.
Returns if the SGLMultiSet contains any copy of x.
Returns the number of copies of x found in the SGLMultiSet.
Returns the element at index n in the SGLMultiSet.
If n is out of bounds, this will crash.
Returns a null iterator associated to this SGLMultiSet.
SGLMultiSet iterators behave circularly. This is equivalent to running operator-- on SGLMultiSet::begin.
SGLMultiSet::Iterator allows modifying the SGLMultiSet through it. If modification is not needed, use SGLMultiSet::ConstIterator instead. The SGLMultiSet::ConstIterator equivalent to this function is SGLMultiSet::constEnd.
Attempting to access the element that this iterator points to will crash.
Removes the element associated with i from the SGLMultiSet.
After the removal, i which is passed as a reference, is decremented. This means that you do not have to do any special handling for removed elements when iterating over a SGLMultiSet.
This returns false if i is SGLMultiSet::end and true otherwise.
Do not write any special logic to modify iterators while removing elements from a SGLMultiSet in a loop, SGLMultiSet::eraseSGLMultiSet::erase handles this for you automatically.
Removes x from the SGLMultiSet.
If there is more than 1 copies of x, the last added copy is removed and other copies remain in the set.
If the SGLMultiSet does not contain any copy of x, this will return false, otherwise this returns true.
Returns the constant iterator pointing to element x.
SGLMultiSet::constEnd is returned if x is not in the SGLMultiSet.
Returns the iterator pointing to element x.
SGLMultiSet::end is returned if x is not in the SGLMultiSet.
Returns the index of x in the SGLMultiSet.
-1 is returned if x is not in the SGLMultiSet.
The index may change if elements are inserted into or removed from SGLMultiSet to keep the SGLMultiSet always sorted.
Returns the index of the element in the SGLMultiSet that i points to.
-1 is returned if i is SGLMultiSet::constEnd.
The index may change if elements are inserted into or removed from SGLMultiSet to keep the SGLMultiSet always sorted.
Returns the index of the element in the SGLMultiSet that i points to.
-1 is returned if i is SGLMultiSet::end.
The index may change if elements are inserted into or removed from SGLMultiSet to keep the SGLMultiSet always sorted.
Inserts x into the SGLMultiSet.
Inserting multiple elements is allowed. If there is already a copy of x, a new copy is added.
Returns the iterator pointing towards the element at index n in the SGLMultiSet.
SGLMultiSet::Iterator allows modifying the SGLMultiSet through it. If modification is not needed, use SGLMultiSet::ConstIterator instead. The SGLMultiSet::ConstIterator equivalent to this function is SGLMultiSet::constIteratorAt.
If n is out of bounds, SGLMultiSet::end is returned.
Returns the length of the SGLMultiSet, that is the number of elements in the SGLMultiSet, counting repeated elements.
Returns a constant iterator to the first element in the SGLMultiSet more than or equal to x.
SGLMultiSet::constEnd is returned if no such iterator exists.
Returns a iterator to the first element in the SGLMultiSet more than or equal to x.
SGLMultiSet::end is returned if no such iterator exists.
Returns a iterator to the first element in the SGLMultiSet strictly more than x.
SGLMultiSet::end is returned if no such iterator exists.
Returns a constant iterator to the first element in the SGLMultiSet strictly more than x.
SGLMultiSet::constEnd is returned if no such iterator exists.
©2025 05524F.sg (Singapore)