|
|
@ -66,8 +66,11 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
void update(const_iterator itIn, const mapped_type& v) |
|
|
|
void update(const_iterator itIn, const mapped_type& v) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// TODO: When we switch to C++11, use map.erase(itIn, itIn) to get the non-const iterator.
|
|
|
|
// Using map::erase() with empty range instead of map::find() to get a non-const iterator,
|
|
|
|
iterator itTarget = map.find(itIn->first); |
|
|
|
// since it is a constant time operation in C++11. For more details, see
|
|
|
|
|
|
|
|
// https://stackoverflow.com/questions/765148/how-to-remove-constness-of-const-iterator
|
|
|
|
|
|
|
|
iterator itTarget = map.erase(itIn, itIn); |
|
|
|
|
|
|
|
|
|
|
|
if (itTarget == map.end()) |
|
|
|
if (itTarget == map.end()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
std::pair<rmap_iterator, rmap_iterator> itPair = rmap.equal_range(itTarget->second); |
|
|
|
std::pair<rmap_iterator, rmap_iterator> itPair = rmap.equal_range(itTarget->second); |
|
|
|