Title: [164377] trunk/Source/WTF
- Revision
- 164377
- Author
- [email protected]
- Date
- 2014-02-19 11:52:00 -0800 (Wed, 19 Feb 2014)
Log Message
SegmentedVector::append() should take in rvalue reference, forward it to Vector::uncheckedAppend()
https://bugs.webkit.org/show_bug.cgi?id=128996
Patch by Zan Dobersek <[email protected]> on 2014-02-19
Reviewed by Brent Fulgham.
* wtf/SegmentedVector.h:
(WTF::SegmentedVector::append): Take in an rvalue reference of the object that's to be appended and
then forward it to Vector::uncheckedAppend(). This avoids unnecessary copies in the current situation
where a const lvalue is accepted and passed on.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (164376 => 164377)
--- trunk/Source/WTF/ChangeLog 2014-02-19 19:22:43 UTC (rev 164376)
+++ trunk/Source/WTF/ChangeLog 2014-02-19 19:52:00 UTC (rev 164377)
@@ -1,3 +1,15 @@
+2014-02-19 Zan Dobersek <[email protected]>
+
+ SegmentedVector::append() should take in rvalue reference, forward it to Vector::uncheckedAppend()
+ https://bugs.webkit.org/show_bug.cgi?id=128996
+
+ Reviewed by Brent Fulgham.
+
+ * wtf/SegmentedVector.h:
+ (WTF::SegmentedVector::append): Take in an rvalue reference of the object that's to be appended and
+ then forward it to Vector::uncheckedAppend(). This avoids unnecessary copies in the current situation
+ where a const lvalue is accepted and passed on.
+
2014-02-19 Dan Bernstein <[email protected]>
Simplify PLATFORM(MAC) && !PLATFORM(IOS) and similar expressions
Modified: trunk/Source/WTF/wtf/SegmentedVector.h (164376 => 164377)
--- trunk/Source/WTF/wtf/SegmentedVector.h 2014-02-19 19:22:43 UTC (rev 164376)
+++ trunk/Source/WTF/wtf/SegmentedVector.h 2014-02-19 19:52:00 UTC (rev 164377)
@@ -148,13 +148,13 @@
return at(size() - 1);
}
- template <typename U> void append(const U& value)
+ template <typename U> void append(U&& value)
{
++m_size;
if (!segmentExistsFor(m_size - 1))
m_segments.append(new Segment);
- segmentFor(m_size - 1)->uncheckedAppend(value);
+ segmentFor(m_size - 1)->uncheckedAppend(std::forward<U>(value));
}
T& alloc()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes