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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 void resize(size_t size); | 613 void resize(size_t size); |
614 void reserveCapacity(size_t newCapacity); | 614 void reserveCapacity(size_t newCapacity); |
615 void reserveInitialCapacity(size_t initialCapacity); | 615 void reserveInitialCapacity(size_t initialCapacity); |
616 void shrinkToFit() { shrinkCapacity(size()); } | 616 void shrinkToFit() { shrinkCapacity(size()); } |
617 | 617 |
618 void clear() { shrinkCapacity(0); } | 618 void clear() { shrinkCapacity(0); } |
619 | 619 |
620 template<typename U> void append(const U*, size_t); | 620 template<typename U> void append(const U*, size_t); |
621 template<typename U> void append(const U&); | 621 template<typename U> void append(const U&); |
622 template<typename U> void uncheckedAppend(const U& val); | 622 template<typename U> void uncheckedAppend(const U& val); |
623 template<size_t otherCapacity> void append(const Vector<T, otherCapacity
, Allocator>&); | |
624 template<typename U, size_t otherCapacity, typename V> void appendVector
(const Vector<U, otherCapacity, V>&); | 623 template<typename U, size_t otherCapacity, typename V> void appendVector
(const Vector<U, otherCapacity, V>&); |
625 | 624 |
626 template<typename U> void insert(size_t position, const U*, size_t); | 625 template<typename U> void insert(size_t position, const U*, size_t); |
627 template<typename U> void insert(size_t position, const U&); | 626 template<typename U> void insert(size_t position, const U&); |
628 template<typename U, size_t c, typename V> void insert(size_t position,
const Vector<U, c, V>&); | 627 template<typename U, size_t c, typename V> void insert(size_t position,
const Vector<U, c, V>&); |
629 | 628 |
630 template<typename U> void prepend(const U*, size_t); | 629 template<typename U> void prepend(const U*, size_t); |
631 template<typename U> void prepend(const U&); | 630 template<typename U> void prepend(const U&); |
632 template<typename U, size_t c, typename V> void prepend(const Vector<U,
c, V>&); | 631 template<typename U, size_t c, typename V> void prepend(const Vector<U,
c, V>&); |
633 | 632 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 | 998 |
1000 template<typename T, size_t inlineCapacity, typename Allocator> template<typ
ename U> | 999 template<typename T, size_t inlineCapacity, typename Allocator> template<typ
ename U> |
1001 ALWAYS_INLINE void Vector<T, inlineCapacity, Allocator>::uncheckedAppend(con
st U& val) | 1000 ALWAYS_INLINE void Vector<T, inlineCapacity, Allocator>::uncheckedAppend(con
st U& val) |
1002 { | 1001 { |
1003 ASSERT(size() < capacity()); | 1002 ASSERT(size() < capacity()); |
1004 const U* ptr = &val; | 1003 const U* ptr = &val; |
1005 new (NotNull, end()) T(*ptr); | 1004 new (NotNull, end()) T(*ptr); |
1006 ++m_size; | 1005 ++m_size; |
1007 } | 1006 } |
1008 | 1007 |
1009 // This method should not be called append, a better name would be appendEle
ments. | |
1010 // It could also be eliminated entirely, and call sites could just use | |
1011 // appendRange(val.begin(), val.end()). | |
1012 template<typename T, size_t inlineCapacity, typename Allocator> template<siz
e_t otherCapacity> | |
1013 inline void Vector<T, inlineCapacity, Allocator>::append(const Vector<T, oth
erCapacity, Allocator>& val) | |
1014 { | |
1015 append(val.begin(), val.size()); | |
1016 } | |
1017 | |
1018 template<typename T, size_t inlineCapacity, typename Allocator> template<typ
ename U, size_t otherCapacity, typename OtherAllocator> | 1008 template<typename T, size_t inlineCapacity, typename Allocator> template<typ
ename U, size_t otherCapacity, typename OtherAllocator> |
1019 inline void Vector<T, inlineCapacity, Allocator>::appendVector(const Vector<
U, otherCapacity, OtherAllocator>& val) | 1009 inline void Vector<T, inlineCapacity, Allocator>::appendVector(const Vector<
U, otherCapacity, OtherAllocator>& val) |
1020 { | 1010 { |
1021 append(val.begin(), val.size()); | 1011 append(val.begin(), val.size()); |
1022 } | 1012 } |
1023 | 1013 |
1024 template<typename T, size_t inlineCapacity, typename Allocator> template<typ
ename U> | 1014 template<typename T, size_t inlineCapacity, typename Allocator> template<typ
ename U> |
1025 void Vector<T, inlineCapacity, Allocator>::insert(size_t position, const U*
data, size_t dataSize) | 1015 void Vector<T, inlineCapacity, Allocator>::insert(size_t position, const U*
data, size_t dataSize) |
1026 { | 1016 { |
1027 RELEASE_ASSERT(position <= size()); | 1017 RELEASE_ASSERT(position <= size()); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 } | 1142 } |
1153 if (this->hasOutOfLineBuffer()) | 1143 if (this->hasOutOfLineBuffer()) |
1154 Allocator::markNoTracing(visitor, buffer()); | 1144 Allocator::markNoTracing(visitor, buffer()); |
1155 } | 1145 } |
1156 | 1146 |
1157 } // namespace WTF | 1147 } // namespace WTF |
1158 | 1148 |
1159 using WTF::Vector; | 1149 using WTF::Vector; |
1160 | 1150 |
1161 #endif // WTF_Vector_h | 1151 #endif // WTF_Vector_h |
OLD | NEW |