+ class ConstIterator {
+ public:
+ ConstIterator(const HashTable* table, int position)
+ : m_table(table)
+ , m_position(position)
+ {
+ skipInvalidKeys();
+ }
+
+ const HashEntry* operator->()
+ {
+ return &m_table->table[m_position];
+ }
+
+ const HashEntry* operator*()
+ {
+ return &m_table->table[m_position];
+ }
+
+ bool operator!=(const ConstIterator& other)
+ {
+ ASSERT(m_table == other.m_table);
+ return m_position != other.m_position;
+ }
+
+ ConstIterator& operator++()
+ {
+ ASSERT(m_position < m_table->compactSize);
+ ++m_position;
+ skipInvalidKeys();
+ return *this;
+ }
+
+ private:
+ void skipInvalidKeys()
+ {
+ ASSERT(m_position <= m_table->compactSize);
+ while (m_position < m_table->compactSize && !m_table->table[m_position].key())
+ ++m_position;
+ ASSERT(m_position <= m_table->compactSize);
+ }
+
+ const HashTable* m_table;
+ int m_position;
+ };
+
+ ConstIterator begin(VM& vm) const
+ {
+ initializeIfNeeded(&vm);
+ return ConstIterator(this, 0);
+ }
+ ConstIterator end(VM& vm) const
+ {
+ initializeIfNeeded(&vm);
+ return ConstIterator(this, compactSize);
+ }
+