LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
map.hh
Go to the documentation of this file.
1 
6 #ifndef MISC_MAP_HH
7 # define MISC_MAP_HH
8 
9 # include <list>
10 # include <map>
11 # include <stdexcept>
12 
13 namespace misc
14 {
17  template <class T, class N>
18  class map
19  {
20  protected:
21  typedef std::map<T, N> map_type;
22 
23  public:
25  typedef typename map_type::key_type key_type;
27  typedef typename map_type::mapped_type mapped_type;
30  typedef typename map_type::value_type value_type;
32  typedef typename map_type::key_compare key_compare;
34  typedef typename map_type::iterator iterator;
36  typedef typename map_type::const_iterator const_iterator;
37 
38  public:
41  map();
43  virtual ~map();
45 
47  virtual map* clone() const;
48 
50  key_compare key_comp() const;
51 
54  virtual iterator find(const T& t);
55  virtual const_iterator find(const T& t) const;
57 
60  virtual iterator xfind(const T& t);
61  virtual const_iterator xfind(const T& t) const;
63 
65  virtual N operator[](const T& t) const;
66 
83  N& operator[](const T& t);
84 
86  virtual N operator()(const T& t) const;
87 
90  virtual std::list<N>
91  operator()(const std::list<T>& ts) const;
92 
95  virtual iterator begin();
96  virtual iterator end();
97  virtual const_iterator begin() const;
98  virtual const_iterator end() const;
100 
103  virtual iterator lower_bound(const T& k);
104  virtual const_iterator lower_bound(const T& k) const;
106 
108  virtual std::pair<iterator, bool> insert(const std::pair<const T, N>& x);
110  virtual void insert(const map& other);
111 
113  template <class... Args>
114  std::pair<iterator, bool> emplace(Args&&... args);
115 
117  virtual bool empty() const;
118 
120  virtual size_t size() const;
121 
123  virtual N take(const T& t);
124 
126  virtual void clear();
127 
129  virtual std::ostream& print(std::ostream& ostr) const;
130 
131  protected:
134  };
135 
136 
138  template <class T, class N>
139  std::ostream& operator<<(std::ostream& ostr, const map<T, N>& m);
140 }
141 
142 # include <misc/map.hxx>
143 
144 #endif // !MISC_MAP_HH