We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c3f090e commit 4ff0c2eCopy full SHA for 4ff0c2e
1 file changed
include/webcc/core/map.h
@@ -122,6 +122,30 @@ namespace webcc
122
const_iterator begin() const { return const_iterator{data_.data()}; }
123
const_iterator end() const { return const_iterator{data_.data() + data_.size()}; }
124
125
+ iterator erase(iterator pos)
126
+ {
127
+ if (pos == end())
128
129
+ return pos;
130
+ }
131
+
132
+ size_t index = static_cast<size_t>(pos.ptr - data_.data());
133
+ data_.erase(index);
134
+ return iterator{data_.data() + index};
135
136
137
+ size_t erase(const Key &key)
138
139
+ int idx = index_of(key);
140
+ if (idx < 0)
141
142
+ return 0;
143
144
145
+ data_.erase(static_cast<size_t>(idx));
146
+ return 1;
147
148
149
bool empty() const { return data_.empty(); }
150
size_t size() const { return data_.size(); }
151
void clear() { data_.clear(); }
0 commit comments