File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ namespace webcc
146146 return m_data[insertion_idx].value ;
147147 }
148148
149- // Basic iterator support
149+ // Basic iterator support - iterates over keys for clean "for key in map" syntax
150150 struct iterator {
151151 Entry* ptr;
152152 Entry* end;
@@ -160,13 +160,9 @@ namespace webcc
160160
161161 bool operator !=(const iterator& other) const { return ptr != other.ptr ; }
162162
163- struct Pair {
164- Key& first;
165- T& second;
166- };
167-
168- Pair operator *() { return {ptr->key , ptr->value }; }
169- Pair* operator ->() { return (Pair*)ptr; } // Hacky, but works for simple usage
163+ // Return key directly for "for key in map" syntax
164+ const Key& operator *() const { return ptr->key ; }
165+ const Key* operator ->() const { return &ptr->key ; }
170166 };
171167
172168 iterator begin () {
You can’t perform that action at this time.
0 commit comments