Files
Seele/src/Engine/Containers/Map.h
T

627 lines
17 KiB
C++
Raw Normal View History

#pragma once
2021-03-31 12:18:16 +02:00
#include <utility>
2021-11-11 20:12:50 +01:00
#include "Array.h"
namespace Seele
{
2020-04-12 15:47:19 +02:00
template <typename K, typename V>
struct Pair
{
public:
2021-11-01 20:25:16 +01:00
Pair()
: key(K()), value(V())
{}
Pair(const Pair& other) = default;
Pair(Pair&& other) = default;
~Pair(){}
Pair& operator=(const Pair& other) = default;
Pair& operator=(Pair&& other) = default;
template<class KeyType>
explicit Pair(KeyType&& key)
: key(std::forward<KeyType>(key)), value(V())
{}
template<class KeyType, class ValueType>
explicit Pair(KeyType&& key, ValueType&& value)
: key(std::forward<KeyType>(key)), value(std::forward<ValueType>(value))
{}
K key;
V value;
2020-04-12 15:47:19 +02:00
};
2021-11-01 20:25:16 +01:00
template <typename K,
typename V,
typename Compare = std::less<K>,
typename Allocator = std::pmr::polymorphic_allocator<Pair<const K,V>>>
2020-04-12 15:47:19 +02:00
struct Map
{
private:
2021-11-01 20:25:16 +01:00
struct Node
{
2021-11-04 23:47:51 +01:00
size_t leftChild;
size_t rightChild;
2021-11-01 20:25:16 +01:00
Pair<K, V> pair;
Node()
2021-11-08 15:39:46 +01:00
: leftChild(-1)
2021-11-04 23:47:51 +01:00
, rightChild(-1)
, pair()
2021-11-01 20:25:16 +01:00
{
}
Node(const Node& other) = default;
Node(Node&& other) = default;
Node& operator=(const Node& other) = default;
Node& operator=(Node&& other) = default;
Node(K key)
2021-11-08 15:39:46 +01:00
: leftChild(-1)
2021-11-04 23:47:51 +01:00
, rightChild(-1)
2021-11-01 20:25:16 +01:00
, pair(std::move(key))
{
}
~Node()
{
}
};
using NodeAlloc = std::allocator_traits<Allocator>::template rebind_alloc<Node>;
2020-04-12 15:47:19 +02:00
public:
2021-11-01 20:25:16 +01:00
template<typename PairType>
class IteratorBase
{
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = PairType;
using difference_type = std::ptrdiff_t;
using reference = PairType&;
using pointer = PairType*;
2021-11-08 15:39:46 +01:00
IteratorBase(size_t x = -1)
2021-11-01 20:25:16 +01:00
: node(x)
{
}
2021-11-08 15:39:46 +01:00
IteratorBase(size_t x, const Array<Node, NodeAlloc>* nodeContainer, Array<size_t> &&beginIt = Array<size_t>())
2021-11-04 23:47:51 +01:00
: node(x), traversal(std::move(beginIt)), nodeContainer(nodeContainer)
2021-11-01 20:25:16 +01:00
{
}
IteratorBase(const IteratorBase &i)
2021-11-08 15:39:46 +01:00
: node(i.node), traversal(i.traversal), nodeContainer(i.nodeContainer)
2021-11-01 20:25:16 +01:00
{
}
IteratorBase(IteratorBase&& i)
2021-11-08 15:39:46 +01:00
: node(std::move(i.node)), traversal(std::move(i.traversal)), nodeContainer(i.nodeContainer)
2021-11-01 20:25:16 +01:00
{
}
IteratorBase& operator=(const IteratorBase& other)
{
if(this != &other)
{
2021-11-08 15:39:46 +01:00
node = other.node;
nodeContainer = other.nodeContainer;
2021-11-01 20:25:16 +01:00
traversal = other.traversal;
}
return *this;
}
IteratorBase& operator=(IteratorBase&& other)
{
if(this != &other)
{
node = std::move(other.node);
2021-11-08 15:39:46 +01:00
nodeContainer = std::move(other.nodeContainer);
2021-11-01 20:25:16 +01:00
traversal = std::move(other.traversal);
}
return *this;
}
reference operator*() const
{
2021-11-08 15:39:46 +01:00
return getNode()->pair;
2021-11-01 20:25:16 +01:00
}
pointer operator->() const
{
2021-11-08 15:39:46 +01:00
return &(getNode()->pair);
2021-11-01 20:25:16 +01:00
}
inline bool operator!=(const IteratorBase &other)
{
return node != other.node;
}
inline bool operator==(const IteratorBase &other)
{
return node == other.node;
}
IteratorBase &operator++()
{
2021-11-08 15:39:46 +01:00
node = getNode()->rightChild;
while (node < nodeContainer->size()
&& getNode()->leftChild < nodeContainer->size())
2021-11-01 20:25:16 +01:00
{
traversal.add(node);
2021-11-08 15:39:46 +01:00
node = getNode()->leftChild;
2021-11-01 20:25:16 +01:00
}
2021-11-08 15:39:46 +01:00
if (node >= nodeContainer->size()
&& traversal.size() > 0)
2021-11-01 20:25:16 +01:00
{
node = traversal.back();
traversal.pop();
}
return *this;
}
IteratorBase &operator--()
{
2021-11-08 15:39:46 +01:00
node = getNode()->leftChild;
while (node < nodeContainer->size()
&& getNode()->rightChild < nodeContainer->size())
2021-11-01 20:25:16 +01:00
{
traversal.add(node);
2021-11-08 15:39:46 +01:00
node = getNode()->rightchild;
2021-11-01 20:25:16 +01:00
}
2021-11-08 15:39:46 +01:00
if (node >= nodeContainer->size()
&& traversal.size() > 0)
2021-11-01 20:25:16 +01:00
{
node = traversal.back();
traversal.pop();
}
return *this;
}
IteratorBase operator--(int)
{
IteratorBase tmp(*this);
--*this;
return tmp;
}
IteratorBase operator++(int)
{
IteratorBase tmp(*this);
++*this;
return tmp;
}
2020-04-12 15:47:19 +02:00
2021-11-01 20:25:16 +01:00
private:
2021-11-08 15:39:46 +01:00
Node* getNode() const
{
return &(*nodeContainer)[node];
}
size_t node;
2021-11-04 23:47:51 +01:00
Array<size_t> traversal;
const Array<Node, NodeAlloc>* nodeContainer;
2021-11-01 20:25:16 +01:00
};
using Iterator = IteratorBase<Pair<K,V>>;
using ConstIterator = IteratorBase<const Pair<K,V>>;
using key_type = K;
using mapped_type = V;
using value_type = Pair<K,V>;
using allocator_type = Allocator;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = std::allocator_traits<Allocator>::pointer;
using const_pointer = std::allocator_traits<Allocator>::const_pointer;
using iterator = Iterator;
using const_iterator = ConstIterator;
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
Map()
2021-11-08 15:39:46 +01:00
: root(-1)
, beginIt(-1)
, endIt(-1)
2021-11-05 00:01:12 +01:00
, iteratorsDirty(true)
2021-11-01 20:25:16 +01:00
, _size(0)
, comp(Compare())
{
}
explicit Map(const Compare& comp,
const Allocator& alloc = Allocator())
: nodeContainer(alloc)
2021-11-08 15:39:46 +01:00
, root(-1)
, beginIt(-1)
, endIt(-1)
2021-11-05 00:01:12 +01:00
, iteratorsDirty(true)
2021-11-01 20:25:16 +01:00
, _size(0)
, comp(comp)
{
}
explicit Map(const Allocator& alloc)
: nodeContainer(alloc)
2021-11-08 15:39:46 +01:00
, root(-1)
, beginIt(-1)
, endIt(-1)
2021-11-05 00:01:12 +01:00
, iteratorsDirty(true)
2021-11-01 20:25:16 +01:00
, _size(0)
, comp(Compare())
{
}
Map(const Map& other)
: nodeContainer(other.nodeContainer)
2021-11-08 15:39:46 +01:00
, root(other.root)
2021-11-01 20:25:16 +01:00
, _size(other._size)
, comp(other.comp)
{
2021-12-02 13:00:03 +01:00
markIteratorsDirty();
2021-11-01 20:25:16 +01:00
}
Map(Map&& other)
: nodeContainer(other.nodeContainer)
2021-11-08 15:39:46 +01:00
, root(std::move(other.root))
2021-11-01 20:25:16 +01:00
, _size(std::move(other._size))
, comp(std::move(other.comp))
{
2021-12-02 13:00:03 +01:00
markIteratorsDirty();
2021-11-01 20:25:16 +01:00
}
~Map()
{
}
Map& operator=(const Map& other)
{
if(this != &other)
{
nodeContainer = other.nodeContainer;
2021-11-08 15:39:46 +01:00
root = other.root;
2021-11-01 20:25:16 +01:00
_size = other._size;
comp = other.comp;
2021-12-02 13:00:03 +01:00
markIteratorsDirty();
2021-11-01 20:25:16 +01:00
}
return *this;
}
Map& operator=(Map&& other)
{
if(this != &other)
{
nodeContainer = std::move(other.nodeContainer);
2021-11-08 15:39:46 +01:00
root = std::move(other.root);
2021-11-01 20:25:16 +01:00
_size = std::move(other._size);
comp = std::move(other.comp);
2021-12-02 13:00:03 +01:00
markIteratorsDirty();
2021-11-01 20:25:16 +01:00
}
return *this;
}
inline mapped_type& operator[](const key_type& key)
{
root = splay(root, key);
2021-12-02 13:00:03 +01:00
if (!isValid(root)
2021-11-08 15:39:46 +01:00
|| comp(getNode(root)->pair.key, key)
|| comp(key, getNode(root)->pair.key))
2021-11-01 20:25:16 +01:00
{
root = insert(root, key);
_size++;
}
2021-12-02 13:00:03 +01:00
markIteratorsDirty();
2021-11-08 15:39:46 +01:00
return getNode(root)->pair.value;
2021-11-01 20:25:16 +01:00
}
inline mapped_type& operator[](key_type&& key)
{
root = splay(root, std::move(key));
2021-12-02 13:00:03 +01:00
if (!isValid(root)
2021-11-08 15:39:46 +01:00
|| comp(getNode(root)->pair.key, key)
|| comp(key, getNode(root)->pair.key))
2021-11-01 20:25:16 +01:00
{
root = insert(root, std::move(key));
_size++;
}
2021-12-02 13:00:03 +01:00
markIteratorsDirty();
2021-11-08 15:39:46 +01:00
return getNode(root)->pair.value;
2021-11-01 20:25:16 +01:00
}
iterator find(const key_type& key)
{
root = splay(root, key);
2021-11-04 23:47:51 +01:00
refreshIterators();
2021-11-08 15:39:46 +01:00
if (!isValid(root)
|| comp(getNode(root)->pair.key, key)
|| comp(key, getNode(root)->pair.key))
2021-11-01 20:25:16 +01:00
{
return endIt;
}
2021-11-08 15:39:46 +01:00
return iterator(root, &nodeContainer);
2021-11-01 20:25:16 +01:00
}
iterator find(key_type&& key)
{
root = splay(root, std::move(key));
2021-11-04 23:47:51 +01:00
refreshIterators();
2021-11-08 15:39:46 +01:00
if (!isValid(root)
|| comp(getNode(root)->pair.key, key)
|| comp(key, getNode(root)->pair.key))
2021-11-01 20:25:16 +01:00
{
return endIt;
}
2021-11-08 15:39:46 +01:00
return iterator(root, &nodeContainer);
2021-11-01 20:25:16 +01:00
}
iterator erase(const key_type& key)
{
root = remove(root, key);
2021-11-04 23:47:51 +01:00
refreshIterators();
2021-11-08 15:39:46 +01:00
return iterator(root, &nodeContainer);
2021-11-01 20:25:16 +01:00
}
iterator erase(K&& key)
{
root = remove(root, std::move(key));
2021-11-04 23:47:51 +01:00
refreshIterators();
2021-11-08 15:39:46 +01:00
return iterator(root, &nodeContainer);
2021-11-01 20:25:16 +01:00
}
void clear()
{
nodeContainer.clear();
2021-11-08 15:39:46 +01:00
root = -1;
2021-11-01 20:25:16 +01:00
_size = 0;
2021-12-02 13:00:03 +01:00
markIteratorsDirty();
2021-11-01 20:25:16 +01:00
}
bool exists(key_type&& key)
{
return find(std::forward<K>(key)) != endIt;
}
iterator begin()
{
if(iteratorsDirty)
{
refreshIterators();
}
return beginIt;
}
iterator end()
{
if(iteratorsDirty)
{
refreshIterators();
}
return endIt;
}
iterator begin() const
{
if(iteratorsDirty)
{
return calcBeginIterator();
}
return beginIt;
}
iterator end() const
{
if(iteratorsDirty)
{
return calcEndIterator();
}
return endIt;
}
bool empty() const
{
return nodeContainer.empty();
}
size_type size() const
{
return _size;
}
2020-04-12 15:47:19 +02:00
private:
2021-11-09 00:11:02 +01:00
void verifyTree()
{
for(size_t i = 0; i < nodeContainer.size(); ++i)
{
bool found = false;
for(auto it : nodeContainer)
{
if(it.leftChild == i)
{
assert(!found);
found = true;
}
if(it.rightChild == i)
{
assert(!found);
found = true;
}
}
if(isValid(nodeContainer[i].leftChild))
{
assert(comp(nodeContainer[nodeContainer[i].leftChild].pair.key, nodeContainer[i].pair.key));
}
if(isValid(nodeContainer[i].rightChild))
{
assert(comp(nodeContainer[i].pair.key, nodeContainer[nodeContainer[i].rightChild].pair.key));
}
}
}
2021-11-08 15:39:46 +01:00
Node* getNode(size_t index) const
2021-11-04 23:47:51 +01:00
{
2021-11-08 15:39:46 +01:00
if(!isValid(index)) return nullptr;
return &nodeContainer[index];
2021-11-04 23:47:51 +01:00
}
2021-11-08 15:39:46 +01:00
inline bool isValid(size_t index) const
2021-11-04 23:47:51 +01:00
{
2021-11-08 15:39:46 +01:00
return index < nodeContainer.size();
2021-11-04 23:47:51 +01:00
}
2021-12-02 13:00:03 +01:00
void markIteratorsDirty()
2021-11-01 20:25:16 +01:00
{
iteratorsDirty = true;
}
void refreshIterators()
{
beginIt = calcBeginIterator();
endIt = calcEndIterator();
iteratorsDirty = false;
}
inline Iterator calcBeginIterator() const
{
2021-12-02 13:00:03 +01:00
size_t beginIndex = root;
Array<size_t> beginTraversal;
while (isValid(beginIndex))
2021-11-01 20:25:16 +01:00
{
2021-12-02 13:00:03 +01:00
beginTraversal.add(beginIndex);
beginIndex = getNode(beginIndex)->leftChild;
2021-11-01 20:25:16 +01:00
}
2021-12-02 13:00:03 +01:00
if(!beginTraversal.empty())
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
beginIndex = beginTraversal.back();
2021-11-01 20:25:16 +01:00
beginTraversal.pop();
}
2021-12-02 13:00:03 +01:00
return Iterator(beginIndex, &nodeContainer, std::move(beginTraversal));
2021-11-01 20:25:16 +01:00
}
inline Iterator calcEndIterator() const
{
2021-12-02 13:00:03 +01:00
size_t endIndex = root;
Array<size_t> endTraversal;
while (isValid(endIndex))
2021-11-01 20:25:16 +01:00
{
2021-12-02 13:00:03 +01:00
endTraversal.add(endIndex);
endIndex = getNode(endIndex)->rightChild;
2021-11-01 20:25:16 +01:00
}
2021-12-02 13:00:03 +01:00
return Iterator(endIndex, &nodeContainer, std::move(endTraversal));
2021-11-01 20:25:16 +01:00
}
Array<Node, NodeAlloc> nodeContainer;
2021-11-08 15:39:46 +01:00
size_t root;
2021-11-01 20:25:16 +01:00
Iterator beginIt;
Iterator endIt;
bool iteratorsDirty;
2021-11-05 00:01:12 +01:00
size_type _size;
2021-11-01 20:25:16 +01:00
Compare comp;
2021-11-08 15:39:46 +01:00
size_t rotateRight(size_t node)
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
Node* x = getNode(node);
size_t res = x->leftChild;
Node* y = getNode(x->leftChild);
x->leftChild = y->rightChild;
2021-11-01 20:25:16 +01:00
y->rightChild = node;
2021-11-08 15:39:46 +01:00
return res;
2021-11-01 20:25:16 +01:00
}
2021-11-08 15:39:46 +01:00
size_t rotateLeft(size_t node)
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
Node* x = getNode(node);
size_t res = x->rightChild;
Node* y = getNode(x->rightChild);
x->rightChild = y->leftChild;
2021-11-01 20:25:16 +01:00
y->leftChild = node;
2021-11-08 15:39:46 +01:00
return res;
2021-11-01 20:25:16 +01:00
}
template<class KeyType>
2021-11-08 15:39:46 +01:00
size_t insert(size_t r, KeyType&& key)
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
if (!isValid(r))
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
nodeContainer.emplace(std::forward<KeyType>(key));
return nodeContainer.size() - 1;
2021-11-01 20:25:16 +01:00
}
r = splay(r, key);
2021-11-09 00:11:02 +01:00
Node* node = getNode(r);
2020-04-12 15:47:19 +02:00
2021-11-08 15:39:46 +01:00
if (!(comp(node->pair.key, key) || comp(key, node->pair.key)))
2021-11-01 20:25:16 +01:00
return r;
2020-04-12 15:47:19 +02:00
2021-11-01 20:25:16 +01:00
Node *newNode = &nodeContainer.emplace(std::forward<KeyType>(key));
2021-11-09 16:38:26 +01:00
node = getNode(r);
2020-04-12 15:47:19 +02:00
2021-11-08 15:39:46 +01:00
if (comp(key, node->pair.key))
2021-11-01 20:25:16 +01:00
{
newNode->rightChild = r;
2021-11-08 15:39:46 +01:00
newNode->leftChild = node->leftChild;
node->leftChild = -1;
2021-11-01 20:25:16 +01:00
}
else
{
newNode->leftChild = r;
2021-11-08 15:39:46 +01:00
newNode->rightChild = node->rightChild;
node->rightChild = -1;
2021-11-01 20:25:16 +01:00
}
2021-11-08 15:39:46 +01:00
return nodeContainer.size() - 1;
2021-11-01 20:25:16 +01:00
}
template<class KeyType>
2021-11-08 15:39:46 +01:00
size_t remove(size_t r, KeyType&& key)
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
size_t temp;
if (!isValid(r))
return -1;
2020-04-12 15:47:19 +02:00
2021-11-01 20:25:16 +01:00
r = splay(r, key);
2021-11-08 15:39:46 +01:00
Node* node = getNode(r);
2020-04-12 15:47:19 +02:00
2021-11-08 15:39:46 +01:00
if (comp(node->pair.key, key) || comp(key, node->pair.key))
2021-11-01 20:25:16 +01:00
return r;
2020-04-12 15:47:19 +02:00
2021-11-08 15:39:46 +01:00
if (!isValid(node->leftChild))
2021-11-01 20:25:16 +01:00
{
temp = r;
2021-11-08 15:39:46 +01:00
r = node->rightChild;
2021-11-01 20:25:16 +01:00
}
else
{
temp = r;
2020-04-12 15:47:19 +02:00
2021-11-08 15:39:46 +01:00
r = splay(node->leftChild, key);
node = getNode(r);
node->rightChild = getNode(temp)->rightChild;
2021-11-01 20:25:16 +01:00
}
2021-11-02 19:42:00 +01:00
Node& lastNode = nodeContainer.back();
2021-11-08 15:39:46 +01:00
size_t lastIndex = nodeContainer.size() - 1;
size_t removedIndex = temp;
2021-11-04 23:47:51 +01:00
//Arrays can only pop back, so we need to move the last element to the deleted index
2021-11-08 15:39:46 +01:00
if(removedIndex != lastIndex)
2021-11-02 19:42:00 +01:00
{
2021-11-04 23:47:51 +01:00
nodeContainer[removedIndex] = std::move(lastNode);
2021-11-08 15:39:46 +01:00
for(auto& it : nodeContainer)
2021-11-02 19:42:00 +01:00
{
2021-11-08 15:39:46 +01:00
if(it.leftChild == lastIndex)
2021-11-04 23:47:51 +01:00
{
it.leftChild = removedIndex;
}
2021-11-08 15:39:46 +01:00
if(it.rightChild == lastIndex)
2021-11-04 23:47:51 +01:00
{
it.rightChild = removedIndex;
}
2021-11-02 19:42:00 +01:00
}
}
nodeContainer.pop();
2021-11-01 20:25:16 +01:00
_size--;
return r;
}
template<class KeyType>
2021-11-08 15:39:46 +01:00
size_t splay(size_t r, KeyType&& key)
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
Node* node = getNode(r);
if (node == nullptr
|| !(comp(node->pair.key, key)
|| comp(key, node->pair.key)))
2021-11-01 20:25:16 +01:00
{
return r;
}
2021-11-08 15:39:46 +01:00
if (comp(key, node->pair.key))
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
if (!isValid(node->leftChild))
2021-11-01 20:25:16 +01:00
return r;
2020-04-12 15:47:19 +02:00
2021-11-08 15:39:46 +01:00
if (comp(key, getNode(node->leftChild)->pair.key))
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
getNode(node->leftChild)->leftChild = splay(getNode(node->leftChild)->leftChild, key);
2020-04-12 15:47:19 +02:00
2021-11-01 20:25:16 +01:00
r = rotateRight(r);
2021-11-08 15:39:46 +01:00
node = getNode(r);
2021-11-01 20:25:16 +01:00
}
2021-11-08 15:39:46 +01:00
else if (comp(getNode(node->leftChild)->pair.key, key))
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
getNode(node->leftChild)->rightChild = splay(getNode(node->leftChild)->rightChild, key);
2020-04-12 15:47:19 +02:00
2021-11-08 15:39:46 +01:00
if (isValid(getNode(node->leftChild)->rightChild))
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
node->leftChild = rotateLeft(node->leftChild);
2021-11-01 20:25:16 +01:00
}
}
2021-11-08 15:39:46 +01:00
return (!isValid(node->leftChild)) ? r : rotateRight(r);
2021-11-01 20:25:16 +01:00
}
else
{
2021-11-08 15:39:46 +01:00
if (!isValid(node->rightChild))
2021-11-01 20:25:16 +01:00
return r;
2021-11-08 15:39:46 +01:00
if (comp(key, getNode(node->rightChild)->pair.key))
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
getNode(node->rightChild)->leftChild = splay(getNode(node->rightChild)->leftChild, key);
2021-11-08 15:39:46 +01:00
if (isValid(getNode(node->rightChild)->leftChild))
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
node->rightChild = rotateRight(node->rightChild);
2021-11-01 20:25:16 +01:00
}
}
2021-11-08 15:39:46 +01:00
else if (comp(getNode(node->rightChild)->pair.key, key))
2021-11-01 20:25:16 +01:00
{
2021-11-08 15:39:46 +01:00
getNode(node->rightChild)->rightChild = splay(getNode(node->rightChild)->rightChild, key);
2021-11-01 20:25:16 +01:00
r = rotateLeft(r);
2021-11-08 15:39:46 +01:00
node = getNode(r);
2021-11-01 20:25:16 +01:00
}
2021-11-08 15:39:46 +01:00
return (!isValid(node->rightChild)) ? r : rotateLeft(r);
2021-11-01 20:25:16 +01:00
}
}
2020-04-12 15:47:19 +02:00
};
} // namespace Seele