summaryrefslogtreecommitdiff
path: root/gcc/hash-map.h
diff options
context:
space:
mode:
authortbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-20 15:10:33 +0000
committertbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-20 15:10:33 +0000
commitd4786b1306863bf9057cc67e76497f3fb4b15759 (patch)
tree168d9d23388f6dc2e32b8bfa107fb0d4e5febde3 /gcc/hash-map.h
parent748005509d0e6e61be95f06975ee3d7e1f7f1bc3 (diff)
downloadgcc-d4786b1306863bf9057cc67e76497f3fb4b15759.tar.gz
remove param1_is usage
gcc/ * hash-map.h (hash_map::iterator): New class. (hash_map::begin): New method. (hash_map::end): Likewise. * alias.c, config/alpha/alpha.c, dwarf2asm.c, omp-low.c, tree.h: replace splay_tree with hash_map. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217869 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/hash-map.h')
-rw-r--r--gcc/hash-map.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/hash-map.h b/gcc/hash-map.h
index a5816dca3ce..f6fdc1c7ab0 100644
--- a/gcc/hash-map.h
+++ b/gcc/hash-map.h
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#define hash_map_h
#include <new>
+#include <utility>
#include "hash-table.h"
/* implement default behavior for traits when types allow it. */
@@ -266,6 +267,39 @@ public:
size_t elements () const { return m_table.elements (); }
+ class iterator
+ {
+ public:
+ explicit iterator (const typename hash_table<hash_entry>::iterator &iter) :
+ m_iter (iter) {}
+
+ iterator &operator++ ()
+ {
+ ++m_iter;
+ return *this;
+ }
+
+ std::pair<Key, Value> operator* ()
+ {
+ hash_entry &e = *m_iter;
+ return std::pair<Key, Value> (e.m_key, e.m_value);
+ }
+
+ bool
+ operator != (const iterator &other) const
+ {
+ return m_iter != other.m_iter;
+ }
+
+ private:
+ typename hash_table<hash_entry>::iterator m_iter;
+ };
+
+ /* Standard iterator retrieval methods. */
+
+ iterator begin () const { return iterator (m_table.begin ()); }
+ iterator end () const { return iterator (m_table.end ()); }
+
private:
template<typename T, typename U, typename V> friend void gt_ggc_mx (hash_map<T, U, V> *);