Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: third_party/WebKit/Source/wtf/Vector.h

Issue 2766723002: Migrate WTF::Vector::prepend() to ::push_front() (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/HexNumber.h ('k') | third_party/WebKit/Source/wtf/VectorTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 template <typename U> 1145 template <typename U>
1146 void insert(size_t position, const U*, size_t); 1146 void insert(size_t position, const U*, size_t);
1147 template <typename U, size_t otherCapacity, typename OtherAllocator> 1147 template <typename U, size_t otherCapacity, typename OtherAllocator>
1148 void insert(size_t position, const Vector<U, otherCapacity, OtherAllocator>&); 1148 void insert(size_t position, const Vector<U, otherCapacity, OtherAllocator>&);
1149 1149
1150 // Insertion to the front. All of these functions will take O(size())-time. 1150 // Insertion to the front. All of these functions will take O(size())-time.
1151 // All of the elements in the vector will be moved to the new locations. 1151 // All of the elements in the vector will be moved to the new locations.
1152 // All of these functions may cause a reallocation. In any case, all the 1152 // All of these functions may cause a reallocation. In any case, all the
1153 // iterators pointing to any element in the vector will be invalidated. 1153 // iterators pointing to any element in the vector will be invalidated.
1154 // 1154 //
1155 // prepend(value) 1155 // push_front(value)
1156 // Insert a single element to the front. 1156 // Insert a single element to the front.
1157 // prepend(buffer, size) 1157 // push_front(buffer, size)
1158 // prependVector(vector) 1158 // prependVector(vector)
1159 // Insert multiple elements represented by either |buffer| and |size| or 1159 // Insert multiple elements represented by either |buffer| and |size| or
1160 // |vector| to the front. The elements will be copied. 1160 // |vector| to the front. The elements will be copied.
1161 template <typename U> 1161 template <typename U>
1162 void prepend(U&&); 1162 void push_front(U&&);
1163 template <typename U> 1163 template <typename U>
1164 void prepend(const U*, size_t); 1164 void push_front(const U*, size_t);
1165 template <typename U, size_t otherCapacity, typename OtherAllocator> 1165 template <typename U, size_t otherCapacity, typename OtherAllocator>
1166 void prependVector(const Vector<U, otherCapacity, OtherAllocator>&); 1166 void prependVector(const Vector<U, otherCapacity, OtherAllocator>&);
1167 1167
1168 // Remove an element or elements at the specified position. These functions 1168 // Remove an element or elements at the specified position. These functions
1169 // take O(size())-time. All of the elements after the removed ones will be 1169 // take O(size())-time. All of the elements after the removed ones will be
1170 // moved to the new locations. All the iterators pointing to any element 1170 // moved to the new locations. All the iterators pointing to any element
1171 // after |position| will be invalidated. 1171 // after |position| will be invalidated.
1172 void remove(size_t position); 1172 void remove(size_t position);
1173 void remove(size_t position, size_t length); 1173 void remove(size_t position, size_t length);
1174 1174
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 template <typename T, size_t inlineCapacity, typename Allocator> 1788 template <typename T, size_t inlineCapacity, typename Allocator>
1789 template <typename U, size_t otherCapacity, typename OtherAllocator> 1789 template <typename U, size_t otherCapacity, typename OtherAllocator>
1790 inline void Vector<T, inlineCapacity, Allocator>::insert( 1790 inline void Vector<T, inlineCapacity, Allocator>::insert(
1791 size_t position, 1791 size_t position,
1792 const Vector<U, otherCapacity, OtherAllocator>& val) { 1792 const Vector<U, otherCapacity, OtherAllocator>& val) {
1793 insert(position, val.begin(), val.size()); 1793 insert(position, val.begin(), val.size());
1794 } 1794 }
1795 1795
1796 template <typename T, size_t inlineCapacity, typename Allocator> 1796 template <typename T, size_t inlineCapacity, typename Allocator>
1797 template <typename U> 1797 template <typename U>
1798 inline void Vector<T, inlineCapacity, Allocator>::prepend(U&& val) { 1798 inline void Vector<T, inlineCapacity, Allocator>::push_front(U&& val) {
1799 insert(0, std::forward<U>(val)); 1799 insert(0, std::forward<U>(val));
1800 } 1800 }
1801 1801
1802 template <typename T, size_t inlineCapacity, typename Allocator> 1802 template <typename T, size_t inlineCapacity, typename Allocator>
1803 template <typename U> 1803 template <typename U>
1804 void Vector<T, inlineCapacity, Allocator>::prepend(const U* data, 1804 void Vector<T, inlineCapacity, Allocator>::push_front(const U* data,
1805 size_t dataSize) { 1805 size_t dataSize) {
1806 insert(0, data, dataSize); 1806 insert(0, data, dataSize);
1807 } 1807 }
1808 1808
1809 template <typename T, size_t inlineCapacity, typename Allocator> 1809 template <typename T, size_t inlineCapacity, typename Allocator>
1810 template <typename U, size_t otherCapacity, typename OtherAllocator> 1810 template <typename U, size_t otherCapacity, typename OtherAllocator>
1811 inline void Vector<T, inlineCapacity, Allocator>::prependVector( 1811 inline void Vector<T, inlineCapacity, Allocator>::prependVector(
1812 const Vector<U, otherCapacity, OtherAllocator>& val) { 1812 const Vector<U, otherCapacity, OtherAllocator>& val) {
1813 insert(0, val.begin(), val.size()); 1813 insert(0, val.begin(), val.size());
1814 } 1814 }
1815 1815
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 visitor, *const_cast<T*>(bufferEntry)); 1901 visitor, *const_cast<T*>(bufferEntry));
1902 checkUnusedSlots(buffer() + size(), buffer() + capacity()); 1902 checkUnusedSlots(buffer() + size(), buffer() + capacity());
1903 } 1903 }
1904 } 1904 }
1905 1905
1906 } // namespace WTF 1906 } // namespace WTF
1907 1907
1908 using WTF::Vector; 1908 using WTF::Vector;
1909 1909
1910 #endif // WTF_Vector_h 1910 #endif // WTF_Vector_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/HexNumber.h ('k') | third_party/WebKit/Source/wtf/VectorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698