aboutsummaryrefslogtreecommitdiff
path: root/gcc/hash-map.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/hash-map.h')
-rw-r--r--gcc/hash-map.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/hash-map.h b/gcc/hash-map.h
index 0b50f72..ec48844 100644
--- a/gcc/hash-map.h
+++ b/gcc/hash-map.h
@@ -93,7 +93,7 @@ private:
static void
mark_key_deleted (T *&k)
{
- k = static_cast<T *> (1);
+ k = reinterpret_cast<T *> (1);
}
template<typename T>
@@ -185,6 +185,11 @@ public:
return e->m_value;
}
+ void remove (const Key &k)
+ {
+ m_table.remove_elt_with_hash (k, Traits::hash (k));
+ }
+
/* Call the call back on each pair of key and value with the passed in
arg. */
@@ -196,6 +201,15 @@ public:
f ((*iter).m_key, (*iter).m_value, a);
}
+ template<typename Arg, bool (*f)(const Key &, Value *, Arg)>
+ void traverse (Arg a) const
+ {
+ for (typename hash_table<hash_entry>::iterator iter = m_table.begin ();
+ iter != m_table.end (); ++iter)
+ if (!f ((*iter).m_key, &(*iter).m_value, a))
+ break;
+ }
+
private:
hash_table<hash_entry> m_table;
};