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

Side by Side Diff: src/utils/SkTLogic.h

Issue 263063002: Add pattern matchers for SkRecord (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: yet more notes Created 6 years, 7 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 | « src/record/SkRecordTraits.h ('k') | tests/RecordPatternTest.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 2013 Google Inc. 2 * Copyright 2013 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 * This header provides some of the helpers (std::integral_constant) and 8 * This header provides some of the helpers (std::integral_constant) and
9 * type transformations (std::conditional) which will become available with 9 * type transformations (std::conditional) which will become available with
10 * C++11 in the type_traits header. 10 * C++11 in the type_traits header.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 struct Fallback { int member; }; \ 82 struct Fallback { int member; }; \
83 struct Derived : T, Fallback {}; \ 83 struct Derived : T, Fallback {}; \
84 template <typename U, U> struct Check; \ 84 template <typename U, U> struct Check; \
85 template <typename U> static uint8_t func(Check<int Fallback::*, &U::member> *); \ 85 template <typename U> static uint8_t func(Check<int Fallback::*, &U::member> *); \
86 template <typename U> static uint16_t func(...); \ 86 template <typename U> static uint16_t func(...); \
87 public: \ 87 public: \
88 typedef HasMember_##member type; \ 88 typedef HasMember_##member type; \
89 static const bool value = sizeof(func<Derived>(NULL)) == sizeof(uint16_t); \ 89 static const bool value = sizeof(func<Derived>(NULL)) == sizeof(uint16_t); \
90 } 90 }
91 91
92 /** SK_WHEN_TYPE is type T if cond_type exists, otherwise it does not exist.
93 * You can use this to enable specializations conditioned on whether a type exi sts.
94 */
95 #define SK_WHEN_TYPE(cond_type, T) typename SkWhenType<cond_type, T>::type
96 template <typename cond_type, typename T>
97 struct SkWhenType { typedef T type; };
98
bungeman-skia 2014/05/05 19:37:51 So it seems the 'normal' way to do this would be t
mtklein 2014/05/05 20:05:12 Strongly agreed and done.
92 #endif 99 #endif
OLDNEW
« no previous file with comments | « src/record/SkRecordTraits.h ('k') | tests/RecordPatternTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698