Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Unified Diff: base/containers/flat_tree.h

Issue 2792343002: Change flat_tree::unsafe_emplace to actually emplace (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/containers/flat_tree.h
diff --git a/base/containers/flat_tree.h b/base/containers/flat_tree.h
index 57335d8882b0268fb6d607595b4bec9579f27c55..fc9482df8d476d514ae32f62f44fbf57444ad159 100644
--- a/base/containers/flat_tree.h
+++ b/base/containers/flat_tree.h
@@ -248,7 +248,7 @@ class flat_tree {
protected:
// Emplaces a new item into the tree that is known not to be in it. This
- // is for implementing map [] and at().
+ // is for implementing map operator[].
template <class... Args>
iterator unsafe_emplace(const_iterator position, Args&&... args);
@@ -683,8 +683,8 @@ auto flat_tree<Key, Value, GetKeyFromValue, KeyCompare>::unsafe_emplace(
const_iterator position,
Args&&... args) -> iterator {
// We have to cast away const because of crbug.com/677044.
- return impl_.body_.insert(const_cast_it(position),
- value_type(std::forward<Args>(args)...));
+ return impl_.body_.emplace(const_cast_it(position),
+ std::forward<Args>(args)...);
jdoerrie 2017/04/04 14:14:13 There was some discussion in the emplace thread cl
dyaroshev 2017/04/04 15:48:21 This wasn't the intention (at least from my point
}
// For containers like sets, the key is the same as the value. This implements
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698