diff options
author | 2015-11-24 17:06:32 +0000 | |
---|---|---|
committer | 2015-11-24 17:06:32 +0000 | |
commit | 13c7449409d309dcaabe10bbd55cb1e318883ecd (patch) | |
tree | ba3effb06573188bc30505656ddee210e7c4061c | |
parent | 22c20ef131812a6e7ff01f8c57ffe1eb0942fc39 (diff) |
ART: Fix SafeMap::Put()/PutBefore() rvalue overloads.
Remove the mistaken "const" qualifier which pretty much
defeats the intended optimizations and prevents using
the SafeMap with non-copyable values.
Change-Id: I07d3e083c0b9b8895cbd181cb1bb4ca2293c7c5d
-rw-r--r-- | runtime/safe_map.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/safe_map.h b/runtime/safe_map.h index 7ac17b60d6..4e62dda8dd 100644 --- a/runtime/safe_map.h +++ b/runtime/safe_map.h @@ -92,7 +92,7 @@ class SafeMap { DCHECK(result.second); // Check we didn't accidentally overwrite an existing value. return result.first; } - iterator Put(const K& k, const V&& v) { + iterator Put(const K& k, V&& v) { std::pair<iterator, bool> result = map_.emplace(k, std::move(v)); DCHECK(result.second); // Check we didn't accidentally overwrite an existing value. return result.first; @@ -105,7 +105,7 @@ class SafeMap { DCHECK(pos == map_.begin() || map_.key_comp()((--iterator(pos))->first, k)); return map_.emplace_hint(pos, k, v); } - iterator PutBefore(iterator pos, const K& k, const V&& v) { + iterator PutBefore(iterator pos, const K& k, V&& v) { // Check that we're using the correct position and the key is not in the map. DCHECK(pos == map_.end() || map_.key_comp()(k, pos->first)); DCHECK(pos == map_.begin() || map_.key_comp()((--iterator(pos))->first, k)); |