| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 } | 606 } |
| 607 | 607 |
| 608 Vector(const Vector&); | 608 Vector(const Vector&); |
| 609 template<size_t otherCapacity> | 609 template<size_t otherCapacity> |
| 610 explicit Vector(const Vector<T, otherCapacity, Allocator>&); | 610 explicit Vector(const Vector<T, otherCapacity, Allocator>&); |
| 611 | 611 |
| 612 Vector& operator=(const Vector&); | 612 Vector& operator=(const Vector&); |
| 613 template<size_t otherCapacity> | 613 template<size_t otherCapacity> |
| 614 Vector& operator=(const Vector<T, otherCapacity, Allocator>&); | 614 Vector& operator=(const Vector<T, otherCapacity, Allocator>&); |
| 615 | 615 |
| 616 #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) |
| 616 Vector(Vector&&); | 617 Vector(Vector&&); |
| 617 Vector& operator=(Vector&&); | 618 Vector& operator=(Vector&&); |
| 619 #endif |
| 618 | 620 |
| 619 size_t size() const { return m_size; } | 621 size_t size() const { return m_size; } |
| 620 size_t capacity() const { return Base::capacity(); } | 622 size_t capacity() const { return Base::capacity(); } |
| 621 bool isEmpty() const { return !size(); } | 623 bool isEmpty() const { return !size(); } |
| 622 | 624 |
| 623 T& at(size_t i) | 625 T& at(size_t i) |
| 624 { | 626 { |
| 625 RELEASE_ASSERT(i < size()); | 627 RELEASE_ASSERT(i < size()); |
| 626 return Base::buffer()[i]; | 628 return Base::buffer()[i]; |
| 627 } | 629 } |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 ASSERT(begin()); | 789 ASSERT(begin()); |
| 788 } | 790 } |
| 789 | 791 |
| 790 std::copy(other.begin(), other.begin() + size(), begin()); | 792 std::copy(other.begin(), other.begin() + size(), begin()); |
| 791 TypeOperations::uninitializedCopy(other.begin() + size(), other.end(), e
nd()); | 793 TypeOperations::uninitializedCopy(other.begin() + size(), other.end(), e
nd()); |
| 792 m_size = other.size(); | 794 m_size = other.size(); |
| 793 | 795 |
| 794 return *this; | 796 return *this; |
| 795 } | 797 } |
| 796 | 798 |
| 799 #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) |
| 797 template<typename T, size_t inlineCapacity, typename Allocator> | 800 template<typename T, size_t inlineCapacity, typename Allocator> |
| 798 Vector<T, inlineCapacity, Allocator>::Vector(Vector<T, inlineCapacity, Alloc
ator>&& other) | 801 Vector<T, inlineCapacity, Allocator>::Vector(Vector<T, inlineCapacity, Alloc
ator>&& other) |
| 799 { | 802 { |
| 800 m_size = 0; | 803 m_size = 0; |
| 801 // It's a little weird to implement a move constructor using swap but th
is way we | 804 // It's a little weird to implement a move constructor using swap but th
is way we |
| 802 // don't have to add a move constructor to VectorBuffer. | 805 // don't have to add a move constructor to VectorBuffer. |
| 803 swap(other); | 806 swap(other); |
| 804 } | 807 } |
| 805 | 808 |
| 806 template<typename T, size_t inlineCapacity, typename Allocator> | 809 template<typename T, size_t inlineCapacity, typename Allocator> |
| 807 Vector<T, inlineCapacity, Allocator>& Vector<T, inlineCapacity, Allocator>::
operator=(Vector<T, inlineCapacity, Allocator>&& other) | 810 Vector<T, inlineCapacity, Allocator>& Vector<T, inlineCapacity, Allocator>::
operator=(Vector<T, inlineCapacity, Allocator>&& other) |
| 808 { | 811 { |
| 809 swap(other); | 812 swap(other); |
| 810 return *this; | 813 return *this; |
| 811 } | 814 } |
| 815 #endif |
| 812 | 816 |
| 813 template<typename T, size_t inlineCapacity, typename Allocator> | 817 template<typename T, size_t inlineCapacity, typename Allocator> |
| 814 template<typename U> | 818 template<typename U> |
| 815 bool Vector<T, inlineCapacity, Allocator>::contains(const U& value) const | 819 bool Vector<T, inlineCapacity, Allocator>::contains(const U& value) const |
| 816 { | 820 { |
| 817 return find(value) != kNotFound; | 821 return find(value) != kNotFound; |
| 818 } | 822 } |
| 819 | 823 |
| 820 template<typename T, size_t inlineCapacity, typename Allocator> | 824 template<typename T, size_t inlineCapacity, typename Allocator> |
| 821 template<typename U> | 825 template<typename U> |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 struct NeedsTracing<Vector<T, N> > { | 1195 struct NeedsTracing<Vector<T, N> > { |
| 1192 static const bool value = false; | 1196 static const bool value = false; |
| 1193 }; | 1197 }; |
| 1194 #endif | 1198 #endif |
| 1195 | 1199 |
| 1196 } // namespace WTF | 1200 } // namespace WTF |
| 1197 | 1201 |
| 1198 using WTF::Vector; | 1202 using WTF::Vector; |
| 1199 | 1203 |
| 1200 #endif // WTF_Vector_h | 1204 #endif // WTF_Vector_h |
| OLD | NEW |