Commit ef71d453 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Some ContiguousMap additions/fixes

parent d78db72a
......@@ -43,12 +43,11 @@ public:
const_iterator begin() const noexcept { return map.begin(); }
const_iterator end() const noexcept { return map.end(); }
iterator erase(const_iterator position) {
void erase(const_iterator position) {
int idx = map[position->first];
free_list.push_back(idx);
vec[idx] = TVal();
map.erase(position->first);
return begin(); // this is broken...
}
size_type erase(const TKey& key) {
......@@ -73,9 +72,9 @@ public:
free_list.pop_back();
} else {
idx = vec.size();
vec.push_back(TVal());
}
map[key] = idx;
vec.push_back(TVal());
return vec[idx];
} else {
return vec[it->second];
......@@ -91,9 +90,9 @@ public:
free_list.pop_back();
} else {
idx = vec.size();
vec.push_back(TVal());
}
map[key] = idx;
vec.push_back(TVal());
return vec[idx];
} else {
return vec[it->second];
......@@ -102,7 +101,8 @@ public:
TVal getMapped(int idx) const { return vec[idx]; }
size_type size() const { return vec.size(); }
size_type size() const { return map.size(); }
bool empty() const { return map.empty(); }
const vec_type& vector() { return vec; }
};
}
......
......@@ -374,7 +374,7 @@ public:
// in the attr_offssets map.
// Also, if we have any children, we can skip scanning our attr_offsets map, since it will be a subset
// of our child's map.
if (!children.size())
if (children.empty())
for (auto p : attr_offsets)
visitor->visit(p.first);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment