28 #ifndef _util_container_avlset_h
29 #define _util_container_avlset_h
31 #include <util/container/avlmap.h>
50 void operator++() { map_->next(node); }
51 void operator++(
int) { operator++(); }
53 {
return map_ == i.map_ && node == i.node; }
55 {
return !(map_ == i.map_ && node == i.node); }
57 { map_ = i.map_; node = i.node; }
58 const K &key()
const {
return node->node.key; }
59 const K &operator *()
const {
return node->node.key; }
64 void clear() { map_.clear(); }
65 void insert(
const K& key) { map_.insert(key,0); }
66 void remove(
const K& key) { map_.remove(key); }
67 int contains(
const K& key)
const {
return map_.contains(key); }
68 iterator find(
const K& k)
const;
70 int height() {
return map_.height(); }
71 void check() { map_.check(); }
73 int length()
const {
return map_.length(); }
75 iterator begin()
const {
return iterator(&map_.map_,map_.map_.start()); }
76 iterator end()
const {
return iterator(&map_.map_,0); }
78 void operator -= (
const AVLSet<K> &s);
79 void operator |= (
const AVLSet<K> &s);
81 void print() { map_.print(); }
86 AVLSet<K>::operator -= (
const AVLSet<K> &s)
88 for (
typename AVLSet<K>::iterator i=s.begin(); i!=s.end(); i++) {
95 AVLSet<K>::operator |= (
const AVLSet<K> &s)
97 for (
typename AVLSet<K>::iterator i=s.begin(); i!=s.end(); i++) {
103 inline typename AVLSet<K>::iterator
104 AVLSet<K>::find(
const K& k)
const
106 return iterator(&map_.map_,map_.map_.find(k));