14template <
typename Key,
typename Compare = less<Key>,
typename Allocator = allocator<Key>>
19template <
typename Key,
typename Compare = less<Key>,
typename Allocator = allocator<Key>>
79 typename TreeType::const_iterator
mTreeIt;
86 return (*mTreeIt).value;
89 return &((*mTreeIt).value);
121 typename TreeType::const_reverse_iterator
mTreeRIt;
128 return (*mTreeRIt).value;
131 return &((*mTreeRIt).value);
167 MultiSetTree(
const Compare& comp = Compare(),
const Allocator& alloc = Allocator())
168 :
mTree(KeyCompareWithId(comp), alloc) {}
178 const Compare& comp = Compare(),
179 const Allocator& alloc = Allocator())
180 :
mTree(KeyCompareWithId(comp), alloc) {
223 template<
typename... Args>
232 template <
typename InputIt>
233 void insert(InputIt first, InputIt last) {
234 for (InputIt it = first; it != last; ++it) {
240 void insert(fl::initializer_list<value_type> ilist) {
241 for (
const auto&
value : ilist) {
255 auto it = range.first;
256 while (it != range.second) {
268 while (first != last) {
271 first = ConstIteratorWrapper(
result.mTreeIt);
286 for (
auto it = range.first; it != range.second; ++it) {
293 ValueWithId search_key(key, 0);
294 auto it =
mTree.lower_bound(search_key);
295 if (it !=
mTree.end() && it->value == key) {
302 ValueWithId search_key(key, 0);
303 auto it =
mTree.lower_bound(search_key);
304 if (it !=
mTree.end() && it->value == key) {
328 ValueWithId search_key(key, 0);
333 ValueWithId search_key(key, 0);
338 ValueWithId search_key(key,
mNextId);
343 ValueWithId search_key(key,
mNextId);
355 return mTree.get_allocator();
360 if (
size() != other.
size())
return false;
361 for (
auto it1 =
begin(), it2 = other.
begin(); it1 !=
end(); ++it1, ++it2) {
370 return !(*
this == other);
374 for (
auto it1 =
begin(), it2 = other.
begin(); it1 !=
end() && it2 != other.
end(); ++it1, ++it2) {
375 if (*it1 < *it2)
return true;
376 if (*it2 < *it1)
return false;
382 return *
this < other || *
this == other;
386 return other < *
this;
390 return other <= *
this;
400template <
typename Key,
typename Compare = fl::less<Key>>
bool operator!=(const ConstIteratorWrapper &other) const
ConstIteratorWrapper operator--(int)
bool operator==(const ConstIteratorWrapper &other) const
TreeType::const_iterator mTreeIt
ConstIteratorWrapper operator++(int)
const value_type & operator*() const
friend class MultiSetTree
ConstIteratorWrapper() FL_NOEXCEPT=default
const value_type * operator->() const
ConstIteratorWrapper & operator++()
ConstIteratorWrapper & operator--()
const value_type & operator*() const
ConstReverseIteratorWrapper & operator--()
ConstReverseIteratorWrapper operator++(int)
ConstReverseIteratorWrapper() FL_NOEXCEPT=default
const value_type * operator->() const
bool operator==(const ConstReverseIteratorWrapper &other) const
friend class MultiSetTree
bool operator!=(const ConstReverseIteratorWrapper &other) const
ConstReverseIteratorWrapper & operator++()
TreeType::const_reverse_iterator mTreeRIt
ConstReverseIteratorWrapper operator--(int)
void insert(InputIt first, InputIt last)
const_reverse_iterator rend() const
const_iterator upper_bound(const Key &key) const
const_iterator end() const
const value_type * const_pointer
const value_type & reference
ConstReverseIteratorWrapper reverse_iterator
iterator erase(const_iterator pos)
bool operator<(const MultiSetTree &other) const
bool operator>=(const MultiSetTree &other) const
const value_type * pointer
MultiSetTree & operator=(MultiSetTree &&other) FL_NOEXCEPT=default
bool contains(const Key &key) const
const_iterator find(const Key &key) const
RedBlackTree< ValueWithId, KeyCompareWithId, Allocator > TreeType
const_iterator cbegin() const
const value_type & const_reference
reverse_iterator rbegin()
~MultiSetTree() FL_NOEXCEPT=default
ConstReverseIteratorWrapper const_reverse_iterator
bool operator!=(const MultiSetTree &other) const
allocator_type get_allocator() const
ConstIteratorWrapper const_iterator
const_iterator begin() const
fl::pair< const_iterator, const_iterator > equal_range(const Key &key) const
ptrdiff_t difference_type
iterator upper_bound(const Key &key)
fl::size erase(const Key &key)
iterator insert(const value_type &value)
MultiSetTree(const Compare &comp=Compare(), const Allocator &alloc=Allocator())
void swap(MultiSetTree &other)
const_reverse_iterator rbegin() const
key_compare key_comp() const
value_compare value_comp() const
MultiSetTree(const MultiSetTree &other) FL_NOEXCEPT=default
fl::size count(const Key &key) const
MultiSetTree(MultiSetTree &&other) FL_NOEXCEPT=default
iterator erase(const_iterator first, const_iterator last)
MultiSetTree(fl::initializer_list< value_type > init, const Compare &comp=Compare(), const Allocator &alloc=Allocator())
fl::size max_size() const
iterator find(const Key &key)
iterator insert(value_type &&value)
MultiSetTree & operator=(const MultiSetTree &other) FL_NOEXCEPT=default
const_iterator lower_bound(const Key &key) const
fl::pair< iterator, iterator > equal_range(const Key &key)
bool operator>(const MultiSetTree &other) const
bool operator==(const MultiSetTree &other) const
bool operator<=(const MultiSetTree &other) const
const_iterator cend() const
void insert(fl::initializer_list< value_type > ilist)
ConstIteratorWrapper iterator
iterator lower_bound(const Key &key)
iterator emplace(Args &&... args)
constexpr T && forward(typename remove_reference< T >::type &t) FL_NOEXCEPT
constexpr remove_reference< T >::type && move(T &&t) FL_NOEXCEPT
void swap(T &a, T &b) FL_NOEXCEPT
constexpr remove_reference< T >::type && move(T &&t) FL_NOEXCEPT
MultiSetTree< Key, Compare, fl::allocator_slab< char > > multi_set
constexpr int type_rank< T >::value
void init(Context &ctx, int w, int h)
expected< T, E > result
Alias for expected (Rust-style naming)
Base definition for an LED controller.
bool operator()(const ValueWithId &a, const ValueWithId &b) const
KeyCompareWithId(const Compare &comp=Compare())
ValueWithId(Key &&v, fl::size id)
ValueWithId() FL_NOEXCEPT=default
const Key & get_key() const