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

Unified Diff: third_party/WebKit/Source/wtf/Vector.h

Issue 2457163002: WTF/std normalization: replace WTF::Vector::emplaceAppend with ::emplace_back (Closed)
Patch Set: rebase + return reference to emplaced element Created 4 years, 1 month 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
Index: third_party/WebKit/Source/wtf/Vector.h
diff --git a/third_party/WebKit/Source/wtf/Vector.h b/third_party/WebKit/Source/wtf/Vector.h
index bb1dced877aa52b4b5dc6ee1925fd5b64eddbb4c..fb69064540f45cafa8b52510a28664c5f7940138 100644
--- a/third_party/WebKit/Source/wtf/Vector.h
+++ b/third_party/WebKit/Source/wtf/Vector.h
@@ -946,7 +946,7 @@ class Vector
template <typename U>
void append(U&&);
template <typename... Args>
- void emplaceAppend(Args&&...);
+ T& emplace_back(Args&&...);
template <typename U>
void uncheckedAppend(U&& val);
template <typename U, size_t otherCapacity, typename V>
@@ -1396,7 +1396,7 @@ ALWAYS_INLINE void Vector<T, inlineCapacity, Allocator>::append(U&& val) {
template <typename T, size_t inlineCapacity, typename Allocator>
template <typename... Args>
-ALWAYS_INLINE void Vector<T, inlineCapacity, Allocator>::emplaceAppend(
+ALWAYS_INLINE T& Vector<T, inlineCapacity, Allocator>::emplace_back(
Args&&... args) {
static_assert(sizeof...(Args), "grow() must be called instead");
static_assert(sizeof...(Args) != 1, "append() must be called instead");
@@ -1406,8 +1406,9 @@ ALWAYS_INLINE void Vector<T, inlineCapacity, Allocator>::emplaceAppend(
expandCapacity(size() + 1);
ANNOTATE_CHANGE_SIZE(begin(), capacity(), m_size, m_size + 1);
- new (NotNull, end()) T(std::forward<Args>(args)...);
+ T* t = new (NotNull, end()) T(std::forward<Args>(args)...);
++m_size;
+ return *t;
}
template <typename T, size_t inlineCapacity, typename Allocator>

Powered by Google App Engine
This is Rietveld 408576698