VectorBuffer::swap doesn't need to use std::swap_ranges
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Sep 2013 18:07:54 +0000 (18:07 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Sep 2013 18:07:54 +0000 (18:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121164

Reviewed by Darin Adler.

There's a std::swap overload for swapping arrays, just use it instead.

* wtf/Vector.h:
(WTF::VectorBuffer::swap):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155542 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WTF/ChangeLog
Source/WTF/wtf/Vector.h

index 670b423..8b8d08f 100644 (file)
@@ -1,5 +1,17 @@
 2013-09-11  Anders Carlsson  <andersca@apple.com>
 
+        VectorBuffer::swap doesn't need to use std::swap_ranges
+        https://bugs.webkit.org/show_bug.cgi?id=121164
+
+        Reviewed by Darin Adler.
+
+        There's a std::swap overload for swapping arrays, just use it instead.
+
+        * wtf/Vector.h:
+        (WTF::VectorBuffer::swap):
+
+2013-09-11  Anders Carlsson  <andersca@apple.com>
+
         Implement Vector::append for move-only types
         https://bugs.webkit.org/show_bug.cgi?id=120805
 
index 13539b3..b6bfbe0 100644 (file)
@@ -458,17 +458,17 @@ public:
     void swap(VectorBuffer& other)
     {
         if (buffer() == inlineBuffer() && other.buffer() == other.inlineBuffer()) {
-            std::swap_ranges(m_inlineBuffer, m_inlineBuffer + inlineCapacity, other.m_inlineBuffer);
+            std::swap(m_inlineBuffer, other.m_inlineBuffer);
             std::swap(m_capacity, other.m_capacity);
         } else if (buffer() == inlineBuffer()) {
             m_buffer = other.m_buffer;
             other.m_buffer = other.inlineBuffer();
-            std::swap_ranges(m_inlineBuffer, m_inlineBuffer + inlineCapacity, other.m_inlineBuffer);
+            std::swap(m_inlineBuffer, other.m_inlineBuffer);
             std::swap(m_capacity, other.m_capacity);
         } else if (other.buffer() == other.inlineBuffer()) {
             other.m_buffer = m_buffer;
             m_buffer = inlineBuffer();
-            std::swap_ranges(m_inlineBuffer, m_inlineBuffer + inlineCapacity, other.m_inlineBuffer);
+            std::swap(m_inlineBuffer, other.m_inlineBuffer);
             std::swap(m_capacity, other.m_capacity);
         } else {
             std::swap(m_buffer, other.m_buffer);