diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 10:36:58 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-01 10:36:58 +0200 |
commit | b1e9e47fa11f608ae16bc07f97a2acf95bf80272 (patch) | |
tree | c88c45e80c9c44506e7cdf9a3bb39ebf82a8cd5b /Source/WTF/wtf/Vector.h | |
parent | be01689f43cf6882cf670d33df49ead1f570c53a (diff) |
Imported WebKit commit 499c84c99aa98e9870fa7eaa57db476c6d160d46 (http://svn.webkit.org/repository/webkit/trunk@119200)
Weekly update :). Particularly relevant changes for Qt are the use of the WebCore image decoders and direct usage
of libpng/libjpeg if available in the system.
Diffstat (limited to 'Source/WTF/wtf/Vector.h')
-rw-r--r-- | Source/WTF/wtf/Vector.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/Source/WTF/wtf/Vector.h b/Source/WTF/wtf/Vector.h index 19e6ffb8c..a3b6a0e62 100644 --- a/Source/WTF/wtf/Vector.h +++ b/Source/WTF/wtf/Vector.h @@ -518,6 +518,11 @@ namespace WTF { template<size_t otherCapacity> Vector& operator=(const Vector<T, otherCapacity>&); +#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) + Vector(Vector&&); + Vector& operator=(Vector&&); +#endif + size_t size() const { return m_size; } size_t capacity() const { return m_buffer.capacity(); } bool isEmpty() const { return !size(); } @@ -759,6 +764,24 @@ namespace WTF { return *this; } +#if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) + template<typename T, size_t inlineCapacity> + Vector<T, inlineCapacity>::Vector(Vector<T, inlineCapacity>&& other) + : m_size(0) + { + // It's a little weird to implement a move constructor using swap but this way we + // don't have to add a move constructor to VectorBuffer. + swap(other); + } + + template<typename T, size_t inlineCapacity> + Vector<T, inlineCapacity>& Vector<T, inlineCapacity>::operator=(Vector<T, inlineCapacity>&& other) + { + swap(other); + return *this; + } +#endif + template<typename T, size_t inlineCapacity> template<typename U> bool Vector<T, inlineCapacity>::contains(const U& value) const @@ -1110,7 +1133,7 @@ namespace WTF { template<typename T, size_t inlineCapacity> inline void Vector<T, inlineCapacity>::remove(size_t position, size_t length) { - ASSERT(position < size()); + ASSERT(position <= size()); ASSERT(position + length <= size()); T* beginSpot = begin() + position; T* endSpot = beginSpot + length; |