microScheme
hashtablemap.hpp
Go to the documentation of this file.
1 template <class Key, class T>
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
25 
26  // overload copy constructor to do a deep copy
27  hashtablemap(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 };
size_type count(const Key &x) const
Definition: hashtablemap.hpp:49
void erase(iterator pos)
Definition: hashtablemap.hpp:42
unsigned int size_type
Definition: hashtablemap.hpp:11
hashtablemap(const Self &x)
Definition: hashtablemap.hpp:27
int difference_type
Definition: hashtablemap.hpp:12
T & operator[](const Key &k)
Definition: hashtablemap.hpp:50
void clear()
Definition: hashtablemap.hpp:44
Definition: hashtablemap.hpp:18
size_type size() const
Definition: hashtablemap.hpp:38
T mapped_type
Definition: hashtablemap.hpp:9
const_iterator find(const Key &x) const
Definition: hashtablemap.hpp:48
Definition: hashtablemap.hpp:2
pair< const Key, T > value_type
Definition: hashtablemap.hpp:10
iterator end()
Definition: hashtablemap.hpp:35
size_type erase(const Key &x)
Definition: hashtablemap.hpp:43
hashtablemap()
Definition: hashtablemap.hpp:24
pair< iterator, bool > insert(const value_type &x)
Definition: hashtablemap.hpp:41
iterator find(const Key &x)
Definition: hashtablemap.hpp:47
const_iterator begin() const
Definition: hashtablemap.hpp:34
Self & operator=(const Self &x)
Definition: hashtablemap.hpp:30
Definition: hashtablemap.hpp:15
const_iterator end() const
Definition: hashtablemap.hpp:36
bool empty() const
Definition: hashtablemap.hpp:37
T data_type
Definition: hashtablemap.hpp:8
hashtablemap< Key, T > Self
Definition: hashtablemap.hpp:4
Key key_type
Definition: hashtablemap.hpp:7
iterator begin()
Definition: hashtablemap.hpp:33