microScheme
bstmap.hpp
Go to the documentation of this file.
1 template <class Key, class T>
2 class bstmap
3 {
5 
6 public:
7  typedef Key key_type;
8  typedef T data_type;
9  typedef T mapped_type;
10  typedef pair<const Key, T> value_type;
11  typedef unsigned int size_type;
12  typedef int difference_type;
13 
14 public:
15  class iterator {
16  // your iterator definition goes here
17  };
19  // like iterator, but points to a const
20  };
21 
22 public:
23  // default constructor to create an empty map
24  bstmap() {}
25 
26  // overload copy constructor to do a deep copy
27  bstmap(const Self& x) {}
28 
29  // overload assignment to do a deep copy
30  Self& operator=(const Self& x) {}
31 
32  // accessors:
34  const_iterator begin() const {}
36  const_iterator end() const {}
37  bool empty() const {}
38  size_type size() const {}
39 
40  // insert/erase
41  pair<iterator,bool> insert(const value_type& x) {}
42  void erase(iterator pos) {}
43  size_type erase(const Key& x) {}
44  void clear() {}
45 
46  // map operations:
47  iterator find(const Key& x) {}
48  const_iterator find(const Key& x) const {}
49  size_type count(const Key& x) const {}
50  T& operator[](const Key& k) {}
51 
52 };
Definition: bstmap.hpp:2
Definition: bstmap.hpp:18
const_iterator end() const
Definition: bstmap.hpp:36
Key key_type
Definition: bstmap.hpp:7
iterator find(const Key &x)
Definition: bstmap.hpp:47
bstmap< Key, T > Self
Definition: bstmap.hpp:4
T data_type
Definition: bstmap.hpp:8
size_type erase(const Key &x)
Definition: bstmap.hpp:43
void erase(iterator pos)
Definition: bstmap.hpp:42
const_iterator find(const Key &x) const
Definition: bstmap.hpp:48
Self & operator=(const Self &x)
Definition: bstmap.hpp:30
const_iterator begin() const
Definition: bstmap.hpp:34
Definition: bstmap.hpp:15
bstmap(const Self &x)
Definition: bstmap.hpp:27
size_type size() const
Definition: bstmap.hpp:38
bool empty() const
Definition: bstmap.hpp:37
T & operator[](const Key &k)
Definition: bstmap.hpp:50
pair< iterator, bool > insert(const value_type &x)
Definition: bstmap.hpp:41
T mapped_type
Definition: bstmap.hpp:9
size_type count(const Key &x) const
Definition: bstmap.hpp:49
unsigned int size_type
Definition: bstmap.hpp:11
bstmap()
Definition: bstmap.hpp:24
void clear()
Definition: bstmap.hpp:44
int difference_type
Definition: bstmap.hpp:12
iterator begin()
Definition: bstmap.hpp:33
iterator end()
Definition: bstmap.hpp:35
pair< const Key, T > value_type
Definition: bstmap.hpp:10