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

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

Issue 1309523003: Remove SK_OFFSETOF from SkTypes, clean up offsetof usage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Speling Created 5 years, 3 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 | « include/private/SkTLogic.h ('k') | include/svg/parser/SkSVGAttribute.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 25 matching lines...) Expand all
36 36
37 template <typename T> inline T&& forward(remove_reference_t<T>& t) /*noexcept*/ { 37 template <typename T> inline T&& forward(remove_reference_t<T>& t) /*noexcept*/ {
38 return static_cast<T&&>(t); 38 return static_cast<T&&>(t);
39 } 39 }
40 template <typename T> inline T&& forward(remove_reference_t<T>&& t) /*noexcept*/ { 40 template <typename T> inline T&& forward(remove_reference_t<T>&& t) /*noexcept*/ {
41 static_assert(!is_lvalue_reference<T>::value, 41 static_assert(!is_lvalue_reference<T>::value,
42 "Forwarding an rvalue reference as an lvalue reference is not allowed."); 42 "Forwarding an rvalue reference as an lvalue reference is not allowed.");
43 return static_cast<T&&>(t); 43 return static_cast<T&&>(t);
44 } 44 }
45 45
46 template <typename T> add_rvalue_reference_t<T> declval();
47
46 } // namespace skstd 48 } // namespace skstd
47 49
48 ///@{ 50 ///@{
49 /** SkTConstType<T, CONST>::type will be 'const T' if CONST is true, 'T' otherwi se. */ 51 /** SkTConstType<T, CONST>::type will be 'const T' if CONST is true, 'T' otherwi se. */
50 template <typename T, bool CONST> struct SkTConstType { 52 template <typename T, bool CONST> struct SkTConstType {
51 typedef T type; 53 typedef T type;
52 }; 54 };
53 template <typename T> struct SkTConstType<T, true> { 55 template <typename T> struct SkTConstType<T, true> {
54 typedef const T type; 56 typedef const T type;
55 }; 57 };
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 * Returns void* because this object does not initialize the 550 * Returns void* because this object does not initialize the
549 * memory. Use placement new for types that require a cons. 551 * memory. Use placement new for types that require a cons.
550 */ 552 */
551 void* get() { return fStorage.get(); } 553 void* get() { return fStorage.get(); }
552 const void* get() const { return fStorage.get(); } 554 const void* get() const { return fStorage.get(); }
553 private: 555 private:
554 SkAlignedSStorage<sizeof(T)*N> fStorage; 556 SkAlignedSStorage<sizeof(T)*N> fStorage;
555 }; 557 };
556 558
557 #endif 559 #endif
OLDNEW
« no previous file with comments | « include/private/SkTLogic.h ('k') | include/svg/parser/SkSVGAttribute.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698