Qx v0.6
Qt Extensions Library
|
The FlatMultiSet class is a container whose elements are always sorted. More...
#include <qx/core/qx-flatmultiset.h>
Public Types | |
using | const_iterator = typename Container::const_iterator |
using | const_pointer = typename Container::const_pointer |
using | const_reference = typename Container::const_reference |
using | const_reverse_iterator = typename Container::const_reverse_iterator |
using | ConstIterator = const_iterator |
using | ConstReverseIterator = const_reverse_iterator |
using | difference_type = typename Container::difference_type |
using | iterator = const_iterator |
using | Iterator = iterator |
using | key_type = typename Container::value_type |
using | pointer = typename Container::pointer |
using | reference = typename Container::reference |
using | reverse_iterator = const_reverse_iterator |
using | ReverseIterator = reverse_iterator |
using | size_type = typename Container::size_type |
using | value_type = typename Container::value_type |
Public Member Functions | |
FlatMultiSet ()=default | |
template<std::input_iterator InputIterator> | |
FlatMultiSet (InputIterator first, InputIterator last) | |
FlatMultiSet (std::initializer_list< T > list) | |
iterator | begin () const |
qsizetype | capacity () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
void | clear () |
const_iterator | constBegin () const |
const_iterator | constEnd () const |
const_iterator | constFind (const T &value) const |
const T & | constFirst () const |
const T & | constLast () const |
const_reverse_iterator | constReverseBegin () const |
const_reverse_iterator | constReverseEnd () const |
bool | contains (const FlatMultiSet &other) const |
bool | contains (const T &value) const |
qsizetype | count () const |
const_reverse_iterator | crbegin () const |
const_reverse_iterator | crend () const |
template<typename ... Args> | |
iterator | emplace (Args &&... args) |
template<typename ... Args> | |
iterator | emplace (const_iterator pos, Args &&... args) |
bool | empty () const |
iterator | end () const |
std::pair< const_iterator, const_iterator > | equal_range (const T &value) const |
iterator | erase (const_iterator pos) |
const_iterator | find (const T &value) const |
const T & | first () const |
iterator | insert (const T &value) |
iterator | insert (const_iterator pos, const T &value) |
bool | isEmpty () const |
const T & | last () const |
const_iterator | lowerBound (const T &value) const |
bool | operator== (const FlatMultiSet &other) const =default |
reverse_iterator | rbegin () const |
qsizetype | remove (const T &value) |
template<typename Predicate > requires flatmultiset_predicate<T, Predicate> | |
qsizetype | removeIf (Predicate pred) |
iterator | rend () const |
void | reserve (qsizetype size) |
qsizetype | size () const |
void | squeeze () |
void | swap (FlatMultiSet &other) |
const_iterator | upperBound (const T &value) const |
QList< T > | values () const |
Essentially a more Qt aligned version of C++23's std::flat_multiset, backed by a QList.
iterator is an alias for const_iterator since modifying an element in-place could affect ordering.
Iterator invalidation rules are the same as for QList.
Qx::FlatMultiSet< T, Compare >::const_iterator = typename Container::const_iterator |
The container's regular iterator type, an alias for QList<T>::const_iterator.
Qx::FlatMultiSet< T, Compare >::const_pointer = typename Container::const_pointer |
Provided for STL compatibility.
Qx::FlatMultiSet< T, Compare >::const_reference = typename Container::const_reference |
Provided for STL compatibility.
Qx::FlatMultiSet< T, Compare >::const_reverse_iterator = typename Container::const_reverse_iterator |
The container's reverse iterator type, an alias for QList<T>::const_reverse_iterator.
Qx::FlatMultiSet< T, Compare >::ConstIterator = const_iterator |
Qt-style synonym for FlatMultiSet::const_iterator.
Qx::FlatMultiSet< T, Compare >::ConstReverseIterator = const_reverse_iterator |
Qt-style synonym for const_reverse_iterator.
Qx::FlatMultiSet< T, Compare >::difference_type = typename Container::difference_type |
Provided for STL compatibility.
Qx::FlatMultiSet< T, Compare >::iterator = const_iterator |
Typedef for const_iterator.
Qx::FlatMultiSet< T, Compare >::Iterator = iterator |
Qt-style synonym for FlatMultiSet::iterator.
Qx::FlatMultiSet< T, Compare >::key_type = typename Container::value_type |
Typedef for T.
Qx::FlatMultiSet< T, Compare >::pointer = typename Container::pointer |
Provided for STL compatibility.
Qx::FlatMultiSet< T, Compare >::reference = typename Container::reference |
Provided for STL compatibility.
Qx::FlatMultiSet< T, Compare >::reverse_iterator = const_reverse_iterator |
Typedef for const_reverse_iterator.
Qx::FlatMultiSet< T, Compare >::ReverseIterator = reverse_iterator |
Qt-style synonym for reverse_iterator.
Qx::FlatMultiSet< T, Compare >::size_type = typename Container::size_type |
Typedef for the container's size_type, usually std::size_t.
Qx::FlatMultiSet< T, Compare >::value_type = typename Container::value_type |
Typedef for T.
|
default |
Creates an empty flat-multiset.
|
inline |
Creates a FlatMultiSet with a copy of each of the elements in the initializer list list.
|
inline |
Creates a FlatMultiSet with a copy of each of the elements between [first, last).
|
inline |
Same as constBegin().
|
inline |
Returns the maximum number of items that can be stored in the flat-multiset without forcing a reallocation.
The sole purpose of this function is to provide a means of fine tuning FlatMultiSet's memory usage. In general, you will rarely ever need to call this function. If you want to know how many items are in the flat-multiset, call size().
|
inline |
Same as constBegin().
|
inline |
Same as constEnd().
|
inline |
Removes all items from the FlatMultiSet.
|
inline |
Returns an STL-style iterator pointing to the first item in the FlatMultiSet.
|
inline |
Returns an STL-style iterator pointing to the imaginary item after the last item in the FlatMultiSet.
|
inline |
Returns an iterator positioned at the item value in the set. If the set contains multiple items of value, it is unspecified to which the iterator points.
If the set contains no item value, the function returns constEnd().
|
inline |
|
inline |
|
inline |
Returns an STL-style iterator pointing to the last item in the FlatMultiSet.
|
inline |
Returns an STL-style iterator pointing to the imaginary item after the first item in the FlatMultiSet.
|
inline |
Returns true
if the FlatMultiSet contains all of the items in other; otherwise, returns false
.
|
inline |
Returns true
if the FlatMultiSet contains value; otherwise, returns false
.
|
inline |
Same as size().
|
inline |
Same as constReverseBegin().
|
inline |
Same as constReverseEnd().
|
inline |
Inserts an item, constructed in-place using the arguments args, into the FlatMultiSet.
If the container has items with the same value, inserts at the upper bound of that range.
Returns an iterator pointing to the new item.
|
inline |
Inserts an item, constructed in-place using the arguments args, into the FlatMultiSet, using pos as a hint as to where the item should be inserted. If the hint is correct, the item is inserted directly to that position; otherwise, this function is equivalent to insert(const T& value), which first has to search for the correct position.
Returns an iterator pointing to the new element.
|
inline |
Same as isEmpty().
|
inline |
Same as constEnd().
|
inline |
Returns a pair of iterators delimiting the range of values [first, second), that are stored with value.
|
inline |
Removes the item pointed to by the iterator pos from the FlatMultiSet, and returns an iterator to the next item in the set.
|
inline |
Same as constFind().
|
inline |
Same as constFirst().
|
inline |
Inserts an item with the value value into the FlatMultiSet.
If the container has items with the same value, inserts at the upper bound of that range.
Returns an iterator pointing to the new item.
|
inline |
Inserts an item with the value value into the FlatMultiSet, using pos as a hint as to where the item should be inserted. If the hint is correct, the item is inserted directly to that position; otherwise, this function is equivalent to insert(const T& value), which first has to search for the correct position.
Returns an iterator pointing to the new element.
|
inline |
Returns true
if the FlatMultiSet contains no items; otherwise, returns false
.
|
inline |
Same as constLast().
|
inline |
Returns an iterator pointing to the first item with value value in the FlatMultiSet. If the set contains no item with value value, the function returns an iterator to the nearest item with a greater value, or constEnd() if there is none.
|
inlinedefault |
Returns true
if other is equal to this FlatMultiSet; otherwise, returns false
.
Two FlatMultiSet's are considered equal if they contain the same items, and only the same items.
This function requires T to implement operator==()
.
|
inline |
Same as constReverseBegin().
|
inline |
Removes all items with the value value from the FlatMultiSet and returns the number of items removed, if any.
|
inline |
Removes all items for which the predicate pred returns true from the FlatMultiSet.
Returns the number of elements removed, if any.
|
inline |
Same as constReverseEnd().
|
inline |
Attempts to allocate memory for at least size elements.
If you know in advance how large the flat-multiset will be, you should call this function to prevent reallocations and memory fragmentation. If you resize the flat-multiset often, you are also likely to get better performance.
If in doubt about how much space shall be needed, it is usually better to use an upper bound as size, or a high estimate of the most likely size, if a strict upper bound would be much bigger than this. If size is an underestimate, the flat-multiset will grow as needed once the reserved size is exceeded, which may lead to a larger allocation than your best overestimate would have and will slow the operation that triggers it.
|
inline |
Returns the number of items in the FlatMultiSet.
|
inline |
Releases any memory not required to store the items.
The sole purpose of this function is to provide a means of fine tuning FlatMultiSet's memory usage. In general, you will rarely ever need to call this function.
|
inline |
Swaps FlatMultiSet other with this FlatMultiSet. This operation is very fast and never fails.
|
inline |
Returns an iterator pointing to the item that immediately follows the last item with value value in the FlatMultiSet. If the set contains no item with value value, the function returns an iterator to the nearest item with a greater value, or constEnd() if there is none.
|
inline |
Returns a list containing all of the values in the FlatMultiSet in order.
This function creates a new list, in linear time. The time and memory use that entails can be avoided by iterating from begin() to end().