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

Side by Side Diff: Source/wtf/TypeTraits.cpp

Issue 835953003: Fix template angle bracket syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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 | « Source/wtf/TypeTraits.h ('k') | 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 static_assert(IsConvertibleToInteger<unsigned long long>::value, "unsigned long long should be convertible to integer"); 169 static_assert(IsConvertibleToInteger<unsigned long long>::value, "unsigned long long should be convertible to integer");
170 #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED) 170 #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
171 static_assert(IsConvertibleToInteger<wchar_t>::value, "whcar_t should be convert ible to integer"); 171 static_assert(IsConvertibleToInteger<wchar_t>::value, "whcar_t should be convert ible to integer");
172 #endif 172 #endif
173 static_assert(IsConvertibleToInteger<double>::value, "double should be convertib le to integer"); 173 static_assert(IsConvertibleToInteger<double>::value, "double should be convertib le to integer");
174 static_assert(IsConvertibleToInteger<long double>::value, "long double should be convertible to integer"); 174 static_assert(IsConvertibleToInteger<long double>::value, "long double should be convertible to integer");
175 static_assert(IsConvertibleToInteger<float>::value, "float should be convertible to integer"); 175 static_assert(IsConvertibleToInteger<float>::value, "float should be convertible to integer");
176 static_assert(!IsConvertibleToInteger<char*>::value, "char* should not be conver tible to integer"); 176 static_assert(!IsConvertibleToInteger<char*>::value, "char* should not be conver tible to integer");
177 static_assert(!IsConvertibleToInteger<const char*>::value, "const char* should n ot be convertible to integer"); 177 static_assert(!IsConvertibleToInteger<const char*>::value, "const char* should n ot be convertible to integer");
178 static_assert(!IsConvertibleToInteger<volatile char*>::value, "volatile char* sh ould not be convertible to integer"); 178 static_assert(!IsConvertibleToInteger<volatile char*>::value, "volatile char* sh ould not be convertible to integer");
179 static_assert(!IsConvertibleToInteger<IsConvertibleToInteger<bool> >::value, "st ruct should not be convertible to integer"); 179 static_assert(!IsConvertibleToInteger<IsConvertibleToInteger<bool>>::value, "str uct should not be convertible to integer");
180 180
181 static_assert((IsPointerConvertible<int, int>::Value), "pointers to the same typ e should be convertible"); 181 static_assert((IsPointerConvertible<int, int>::Value), "pointers to the same typ e should be convertible");
182 static_assert((!IsPointerConvertible<int, unsigned>::Value), "int pointers shoul d not be convertible to unsigned pointers"); 182 static_assert((!IsPointerConvertible<int, unsigned>::Value), "int pointers shoul d not be convertible to unsigned pointers");
183 static_assert((IsPointerConvertible<int, const int>::Value), "int pointers shoul d be convertible to const int pointers"); 183 static_assert((IsPointerConvertible<int, const int>::Value), "int pointers shoul d be convertible to const int pointers");
184 static_assert((!IsPointerConvertible<const int, int>::Value), "const int* should not be convertible to int*"); 184 static_assert((!IsPointerConvertible<const int, int>::Value), "const int* should not be convertible to int*");
185 static_assert((IsPointerConvertible<int, volatile int>::Value), "int* should be convertible to volatile int*"); 185 static_assert((IsPointerConvertible<int, volatile int>::Value), "int* should be convertible to volatile int*");
186 186
187 static_assert((IsSameType<bool, bool>::value), "bool should be the same type as itself"); 187 static_assert((IsSameType<bool, bool>::value), "bool should be the same type as itself");
188 static_assert((IsSameType<int*, int*>::value), "int* should be the same type as itself"); 188 static_assert((IsSameType<int*, int*>::value), "int* should be the same type as itself");
189 static_assert((!IsSameType<int, int*>::value), "int should not be the same type as int*"); 189 static_assert((!IsSameType<int, int*>::value), "int should not be the same type as int*");
190 static_assert((!IsSameType<bool, const bool>::value), "T should not be the same type as const T"); 190 static_assert((!IsSameType<bool, const bool>::value), "T should not be the same type as const T");
191 static_assert((!IsSameType<bool, volatile bool>::value), "T should not be the sa me type as volatile T"); 191 static_assert((!IsSameType<bool, volatile bool>::value), "T should not be the sa me type as volatile T");
192 192
193 template <typename T> 193 template <typename T>
194 class TestBaseClass { 194 class TestBaseClass {
195 }; 195 };
196 196
197 class TestDerivedClass : public TestBaseClass<int> { 197 class TestDerivedClass : public TestBaseClass<int> {
198 }; 198 };
199 199
200 static_assert((IsSubclass<TestDerivedClass, TestBaseClass<int> >::value), "Deriv ed class should be a subclass of its base"); 200 static_assert((IsSubclass<TestDerivedClass, TestBaseClass<int>>::value), "Derive d class should be a subclass of its base");
201 static_assert((!IsSubclass<TestBaseClass<int>, TestDerivedClass>::value), "Base class should not be a sublass of a derived class"); 201 static_assert((!IsSubclass<TestBaseClass<int>, TestDerivedClass>::value), "Base class should not be a sublass of a derived class");
202 static_assert((IsSubclassOfTemplate<TestDerivedClass, TestBaseClass>::value), "D erived class should be a subclass of template from its base"); 202 static_assert((IsSubclassOfTemplate<TestDerivedClass, TestBaseClass>::value), "D erived class should be a subclass of template from its base");
203 static_assert((IsSameType<RemoveTemplate<TestBaseClass<int>, TestBaseClass>::Typ e, int>::value), "RemoveTemplate should remove the template typename from the ty pe"); 203 static_assert((IsSameType<RemoveTemplate<TestBaseClass<int>, TestBaseClass>::Typ e, int>::value), "RemoveTemplate should remove the template typename from the ty pe");
204 static_assert((IsSameType<RemoveTemplate<int, TestBaseClass>::Type, int>::value) , "RemoveTemplate should not alter non-template types"); 204 static_assert((IsSameType<RemoveTemplate<int, TestBaseClass>::Type, int>::value) , "RemoveTemplate should not alter non-template types");
205 static_assert((IsPointerConvertible<TestDerivedClass, TestBaseClass<int> >::Valu e), "Derived class pointers should be convertible to base class pointers"); 205 static_assert((IsPointerConvertible<TestDerivedClass, TestBaseClass<int>>::Value ), "Derived class pointers should be convertible to base class pointers");
206 static_assert((!IsPointerConvertible<TestBaseClass<int>, TestDerivedClass>::Valu e), "Base class pointers should not be convertible to derived class pointers"); 206 static_assert((!IsPointerConvertible<TestBaseClass<int>, TestDerivedClass>::Valu e), "Base class pointers should not be convertible to derived class pointers");
207 207
208 static_assert((IsSameType<bool, RemoveConst<const bool>::Type>::value), "RemoveC onst should produce the corresponding non-const type"); 208 static_assert((IsSameType<bool, RemoveConst<const bool>::Type>::value), "RemoveC onst should produce the corresponding non-const type");
209 static_assert((!IsSameType<bool, RemoveConst<volatile bool>::Type>::value), "Rem oveConst of volatile types should not remove volatility"); 209 static_assert((!IsSameType<bool, RemoveConst<volatile bool>::Type>::value), "Rem oveConst of volatile types should not remove volatility");
210 210
211 static_assert((IsSameType<bool, RemoveVolatile<bool>::Type>::value), "RemoveVola tile should not modify the type of non-volatile types"); 211 static_assert((IsSameType<bool, RemoveVolatile<bool>::Type>::value), "RemoveVola tile should not modify the type of non-volatile types");
212 static_assert((!IsSameType<bool, RemoveVolatile<const bool>::Type>::value), "Rem oveVolatile should not remove const-ness"); 212 static_assert((!IsSameType<bool, RemoveVolatile<const bool>::Type>::value), "Rem oveVolatile should not remove const-ness");
213 static_assert((IsSameType<bool, RemoveVolatile<volatile bool>::Type>::value), "R emoveVolatile should produce the equivalent non-volatile type"); 213 static_assert((IsSameType<bool, RemoveVolatile<volatile bool>::Type>::value), "R emoveVolatile should produce the equivalent non-volatile type");
214 214
215 static_assert((IsSameType<bool, RemoveConstVolatile<bool>::Type>::value), "Remov eConstVolatile should not modify the type of non-const non-volatile types"); 215 static_assert((IsSameType<bool, RemoveConstVolatile<bool>::Type>::value), "Remov eConstVolatile should not modify the type of non-const non-volatile types");
(...skipping 12 matching lines...) Expand all
228 typedef int IntArray[]; 228 typedef int IntArray[];
229 typedef int IntArraySized[4]; 229 typedef int IntArraySized[4];
230 230
231 static_assert((IsArray<IntArray>::value), "IsArray should recognize arrays"); 231 static_assert((IsArray<IntArray>::value), "IsArray should recognize arrays");
232 static_assert((IsArray<IntArraySized>::value), "IsArray should recognize sized a rrays"); 232 static_assert((IsArray<IntArraySized>::value), "IsArray should recognize sized a rrays");
233 233
234 static_assert((IsSameType<int, RemoveExtent<IntArray>::Type>::value), "RemoveExt ent should return the array element type of an array"); 234 static_assert((IsSameType<int, RemoveExtent<IntArray>::Type>::value), "RemoveExt ent should return the array element type of an array");
235 static_assert((IsSameType<int, RemoveExtent<IntArraySized>::Type>::value), "Remo veExtent should return the array element type of a sized array"); 235 static_assert((IsSameType<int, RemoveExtent<IntArraySized>::Type>::value), "Remo veExtent should return the array element type of a sized array");
236 236
237 } // namespace WTF 237 } // namespace WTF
OLDNEW
« no previous file with comments | « Source/wtf/TypeTraits.h ('k') | Source/wtf/Vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698