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

Side by Side Diff: third_party/WebKit/Source/wtf/TypeTraits.h

Issue 2386843002: reflow comments in wtf (Closed)
Patch Set: comments (heh!) Created 4 years, 2 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 | « third_party/WebKit/Source/wtf/TreeNode.h ('k') | third_party/WebKit/Source/wtf/Vector.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 (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 28 matching lines...) Expand all
39 template <typename T> 39 template <typename T>
40 struct IsWeak { 40 struct IsWeak {
41 static const bool value = false; 41 static const bool value = false;
42 }; 42 };
43 43
44 enum WeakHandlingFlag { 44 enum WeakHandlingFlag {
45 NoWeakHandlingInCollections, 45 NoWeakHandlingInCollections,
46 WeakHandlingInCollections 46 WeakHandlingInCollections
47 }; 47 };
48 48
49 // Compilers behave differently on __has_trivial_assign(T) if T has a user-delet ed copy assignment operator: 49 // Compilers behave differently on __has_trivial_assign(T) if T has a
50 // user-deleted copy assignment operator:
50 // 51 //
51 // * MSVC returns false; but 52 // * MSVC returns false; but
52 // * The others return true. 53 // * The others return true.
53 // 54 //
54 // To workaround that, here we have IsAssignable<T, From> class template, but un fortunately, MSVC 2013 cannot compile 55 // To workaround that, here we have IsAssignable<T, From> class template, but
55 // it due to the lack of expression SFINAE. 56 // unfortunately, MSVC 2013 cannot compile it due to the lack of expression
57 // SFINAE.
56 // 58 //
57 // Thus, IsAssignable is only defined on non-MSVC compilers. 59 // Thus, IsAssignable is only defined on non-MSVC compilers.
58 #if !COMPILER(MSVC) || COMPILER(CLANG) 60 #if !COMPILER(MSVC) || COMPILER(CLANG)
59 template <typename T, typename From> 61 template <typename T, typename From>
60 class IsAssignable { 62 class IsAssignable {
61 typedef char YesType; 63 typedef char YesType;
62 struct NoType { 64 struct NoType {
63 char padding[8]; 65 char padding[8];
64 }; 66 };
65 67
(...skipping 27 matching lines...) Expand all
93 #if COMPILER(MSVC) && !COMPILER(CLANG) 95 #if COMPILER(MSVC) && !COMPILER(CLANG)
94 static const bool value = __has_trivial_assign(T); 96 static const bool value = __has_trivial_assign(T);
95 #else 97 #else
96 static const bool value = 98 static const bool value =
97 __has_trivial_assign(T) && IsCopyAssignable<T>::value; 99 __has_trivial_assign(T) && IsCopyAssignable<T>::value;
98 #endif 100 #endif
99 }; 101 };
100 102
101 template <typename T> 103 template <typename T>
102 struct IsTriviallyMoveAssignable { 104 struct IsTriviallyMoveAssignable {
103 // TODO(yutak): This isn't really correct, because __has_trivial_assign appear s to look only at copy assignment. 105 // TODO(yutak): This isn't really correct, because __has_trivial_assign
104 // However, std::is_trivially_move_assignable isn't available at this moment, and there isn't a good way to 106 // appears to look only at copy assignment. However,
105 // write that ourselves. 107 // std::is_trivially_move_assignable isn't available at this moment, and
108 // there isn't a good way to write that ourselves.
106 // 109 //
107 // Here we use IsTriviallyCopyAssignable as a conservative approximation: if T is trivially copy assignable, 110 // Here we use IsTriviallyCopyAssignable as a conservative approximation: if T
108 // T is trivially move assignable, too. This definition misses a case where T is trivially move-only assignable, 111 // is trivially copy assignable, T is trivially move assignable, too. This
109 // but such cases should be rare. 112 // definition misses a case where T is trivially move-only assignable, but
113 // such cases should be rare.
110 static const bool value = IsTriviallyCopyAssignable<T>::value; 114 static const bool value = IsTriviallyCopyAssignable<T>::value;
111 }; 115 };
112 116
113 // Same as above, but for __has_trivial_constructor and __has_trivial_destructor . For IsTriviallyDefaultConstructible, 117 // Same as above, but for __has_trivial_constructor and
114 // we don't have to write IsDefaultConstructible ourselves since we can use std: :is_constructible<T>. For 118 // __has_trivial_destructor. For IsTriviallyDefaultConstructible, we don't have
115 // IsTriviallyDestructible, though, we can't rely on std::is_destructible<T> rig ht now. 119 // to write IsDefaultConstructible ourselves since we can use
120 // std::is_constructible<T>. For IsTriviallyDestructible, though, we can't rely
121 // on std::is_destructible<T> right now.
116 #if !COMPILER(MSVC) || COMPILER(CLANG) 122 #if !COMPILER(MSVC) || COMPILER(CLANG)
117 template <typename T> 123 template <typename T>
118 class IsDestructible { 124 class IsDestructible {
119 typedef char YesType; 125 typedef char YesType;
120 struct NoType { 126 struct NoType {
121 char padding[8]; 127 char padding[8];
122 }; 128 };
123 129
124 template <typename T2, typename = decltype(std::declval<T2>().~T2())> 130 template <typename T2, typename = decltype(std::declval<T2>().~T2())>
125 static YesType checkDestructibility(int); 131 static YesType checkDestructibility(int);
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 class IsPointerToGarbageCollectedType<T*, false> { 406 class IsPointerToGarbageCollectedType<T*, false> {
401 public: 407 public:
402 static const bool value = IsGarbageCollectedType<T>::value; 408 static const bool value = IsGarbageCollectedType<T>::value;
403 }; 409 };
404 410
405 } // namespace WTF 411 } // namespace WTF
406 412
407 using WTF::IsGarbageCollectedType; 413 using WTF::IsGarbageCollectedType;
408 414
409 #endif // TypeTraits_h 415 #endif // TypeTraits_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/TreeNode.h ('k') | third_party/WebKit/Source/wtf/Vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698