66 lines
1.3 KiB
C++
66 lines
1.3 KiB
C++
|
#pragma once
|
|||
|
|
|||
|
#include "RBTree.hpp"
|
|||
|
|
|||
|
namespace Lenyiin
|
|||
|
{
|
|||
|
template <class K>
|
|||
|
class Set
|
|||
|
{
|
|||
|
struct SetKeyOfT
|
|||
|
{
|
|||
|
const K& operator()(const K& k)
|
|||
|
{
|
|||
|
return k;
|
|||
|
}
|
|||
|
};
|
|||
|
|
|||
|
public:
|
|||
|
// <20><><EFBFBD><EFBFBD>RBTree<K, K, SetKeyOfT>::iterator<6F><72>û<EFBFBD><C3BB>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>, ϵͳ<CFB5>Ҳ<EFBFBD><D2B2><EFBFBD>, typename<6D><65><EFBFBD>߱<EFBFBD><DFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><C8B2>ż<EFBFBD><C5BC><EFBFBD>
|
|||
|
typedef typename RBTree<K, K, SetKeyOfT>::iterator iterator;
|
|||
|
typedef typename RBTree<K, K, SetKeyOfT>::const_iterator const_iterator;
|
|||
|
|
|||
|
iterator begin()
|
|||
|
{
|
|||
|
return _tree.begin();
|
|||
|
}
|
|||
|
|
|||
|
iterator end()
|
|||
|
{
|
|||
|
return _tree.end();
|
|||
|
}
|
|||
|
|
|||
|
const_iterator begin() const
|
|||
|
{
|
|||
|
return _tree.begin();
|
|||
|
}
|
|||
|
|
|||
|
const_iterator end() const
|
|||
|
{
|
|||
|
return _tree.end();
|
|||
|
}
|
|||
|
|
|||
|
std::pair<iterator, bool> Insert(const K& key)
|
|||
|
{
|
|||
|
return _tree.Insert(key);
|
|||
|
}
|
|||
|
|
|||
|
bool Erase(const K& key)
|
|||
|
{
|
|||
|
return _tree.Erase(key);
|
|||
|
}
|
|||
|
|
|||
|
iterator& Find(const K& key)
|
|||
|
{
|
|||
|
return _tree.Find(key);
|
|||
|
}
|
|||
|
|
|||
|
bool IsRBTree()
|
|||
|
{
|
|||
|
return _tree.IsRBTree();
|
|||
|
}
|
|||
|
|
|||
|
private:
|
|||
|
RBTree<K, K, SetKeyOfT> _tree;
|
|||
|
};
|
|||
|
}
|