Used to insert a new mapping at a known position for better performance.
| 104 | |
| 105 | // Used to insert a new mapping at a known position for better performance. |
| 106 | iterator PutBefore(const_iterator pos, const K& k, const V& v) { |
| 107 | // Check that we're using the correct position and the key is not in the map. |
| 108 | DCHECK(pos == map_.end() || map_.key_comp()(k, pos->first)); |
| 109 | DCHECK(pos == map_.begin() || map_.key_comp()((--const_iterator(pos))->first, k)); |
| 110 | return map_.emplace_hint(pos, k, v); |
| 111 | } |
| 112 | iterator PutBefore(const_iterator pos, const K& k, V&& v) { |
| 113 | // Check that we're using the correct position and the key is not in the map. |
| 114 | DCHECK(pos == map_.end() || map_.key_comp()(k, pos->first)); |