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

Side by Side Diff: include/private/SkTArray.h

Issue 1767713002: SkPDF: PDFDevice use SkTArray<T> rather than SkTDArray<T*> (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-03-04 (Friday) 16:33:27 EST Created 4 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 | « no previous file | src/pdf/SkPDFDevice.h » ('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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkTArray_DEFINED 8 #ifndef SkTArray_DEFINED
9 #define SkTArray_DEFINED 9 #define SkTArray_DEFINED
10 10
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 /** 149 /**
150 * Version of above that uses a copy constructor to initialize the new item 150 * Version of above that uses a copy constructor to initialize the new item
151 */ 151 */
152 T& push_back(const T& t) { 152 T& push_back(const T& t) {
153 T* newT = reinterpret_cast<T*>(this->push_back_raw(1)); 153 T* newT = reinterpret_cast<T*>(this->push_back_raw(1));
154 new (newT) T(t); 154 new (newT) T(t);
155 return *newT; 155 return *newT;
156 } 156 }
157 157
158 /** 158 /**
159 * Version of above that uses a move constructor to initialize the new item
160 */
161 T& push_back(T&& t) {
162 T* newT = reinterpret_cast<T*>(this->push_back_raw(1));
163 new (newT) T(std::move(t));
164 return *newT;
165 }
166
167 /**
159 * Construct a new T at the back of this array. 168 * Construct a new T at the back of this array.
160 */ 169 */
161 template<class... Args> T& emplace_back(Args&&... args) { 170 template<class... Args> T& emplace_back(Args&&... args) {
162 T* newT = reinterpret_cast<T*>(this->push_back_raw(1)); 171 T* newT = reinterpret_cast<T*>(this->push_back_raw(1));
163 return *new (newT) T(std::forward<Args>(args)...); 172 return *new (newT) T(std::forward<Args>(args)...);
164 } 173 }
165 174
166 /** 175 /**
167 * Allocates n more default-initialized T values, and returns the address of 176 * Allocates n more default-initialized T values, and returns the address of
168 * the start of that new range. Note: this address is only valid until the 177 * the start of that new range. Note: this address is only valid until the
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 SkSTArray& operator= (const INHERITED& array) { 515 SkSTArray& operator= (const INHERITED& array) {
507 INHERITED::operator=(array); 516 INHERITED::operator=(array);
508 return *this; 517 return *this;
509 } 518 }
510 519
511 private: 520 private:
512 SkAlignedSTStorage<N,T> fStorage; 521 SkAlignedSTStorage<N,T> fStorage;
513 }; 522 };
514 523
515 #endif 524 #endif
OLDNEW
« no previous file with comments | « no previous file | src/pdf/SkPDFDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698