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

Side by Side Diff: include/core/SkTemplates.h

Issue 925613002: Spin off SkTHashTable, SkTHashMap, SkTHashSet (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: windows Created 5 years, 10 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 | « gyp/tests.gypi ('k') | src/core/SkTHash.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkTemplates_DEFINED 10 #ifndef SkTemplates_DEFINED
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 */ 247 */
248 T* get() const { return fArray; } 248 T* get() const { return fArray; }
249 249
250 /** Return the nth element in the array 250 /** Return the nth element in the array
251 */ 251 */
252 T& operator[](int index) const { 252 T& operator[](int index) const {
253 SkASSERT((unsigned)index < (unsigned)fCount); 253 SkASSERT((unsigned)index < (unsigned)fCount);
254 return fArray[index]; 254 return fArray[index];
255 } 255 }
256 256
257 void swap(SkAutoTArray& other) {
258 SkTSwap(fArray, other.fArray);
259 SkDEBUGCODE(SkTSwap(fCount, other.fCount));
260 }
261
257 private: 262 private:
258 T* fArray; 263 T* fArray;
259 SkDEBUGCODE(int fCount;) 264 SkDEBUGCODE(int fCount;)
260 }; 265 };
261 266
262 /** Wraps SkAutoTArray, with room for up to N elements preallocated 267 /** Wraps SkAutoTArray, with room for up to N elements preallocated
263 */ 268 */
264 template <int N, typename T> class SkAutoSTArray : SkNoncopyable { 269 template <int N, typename T> class SkAutoSTArray : SkNoncopyable {
265 public: 270 public:
266 /** Initialize with no objects */ 271 /** Initialize with no objects */
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 /** 499 /**
495 * Returns void* because this object does not initialize the 500 * Returns void* because this object does not initialize the
496 * memory. Use placement new for types that require a cons. 501 * memory. Use placement new for types that require a cons.
497 */ 502 */
498 void* get() { return fStorage.get(); } 503 void* get() { return fStorage.get(); }
499 private: 504 private:
500 SkAlignedSStorage<sizeof(T)*N> fStorage; 505 SkAlignedSStorage<sizeof(T)*N> fStorage;
501 }; 506 };
502 507
503 #endif 508 #endif
OLDNEW
« no previous file with comments | « gyp/tests.gypi ('k') | src/core/SkTHash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698