OLD | NEW |
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 178 } |
179 | 179 |
180 /** | 180 /** |
181 * Version of above that uses a copy constructor to initialize all n items | 181 * Version of above that uses a copy constructor to initialize all n items |
182 * to the same T. | 182 * to the same T. |
183 */ | 183 */ |
184 T* push_back_n(int n, const T& t) { | 184 T* push_back_n(int n, const T& t) { |
185 SkASSERT(n >= 0); | 185 SkASSERT(n >= 0); |
186 T* newTs = reinterpret_cast<T*>(this->push_back_raw(n)); | 186 T* newTs = reinterpret_cast<T*>(this->push_back_raw(n)); |
187 for (int i = 0; i < n; ++i) { | 187 for (int i = 0; i < n; ++i) { |
188 new (newTs[i]) T(t); | 188 new (newTs + i) T(t); |
189 } | 189 } |
190 return newTs; | 190 return newTs; |
191 } | 191 } |
192 | 192 |
193 /** | 193 /** |
194 * Version of above that uses a copy constructor to initialize the n items | 194 * Version of above that uses a copy constructor to initialize the n items |
195 * to separate T values. | 195 * to separate T values. |
196 */ | 196 */ |
197 T* push_back_n(int n, const T t[]) { | 197 T* push_back_n(int n, const T t[]) { |
198 SkASSERT(n >= 0); | 198 SkASSERT(n >= 0); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 SkSTArray& operator= (const INHERITED& array) { | 506 SkSTArray& operator= (const INHERITED& array) { |
507 INHERITED::operator=(array); | 507 INHERITED::operator=(array); |
508 return *this; | 508 return *this; |
509 } | 509 } |
510 | 510 |
511 private: | 511 private: |
512 SkAlignedSTStorage<N,T> fStorage; | 512 SkAlignedSTStorage<N,T> fStorage; |
513 }; | 513 }; |
514 | 514 |
515 #endif | 515 #endif |
OLD | NEW |