OLD | NEW |
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 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 * | 18 * |
19 */ | 19 */ |
20 | 20 |
21 #ifndef WTF_VectorTraits_h | 21 #ifndef WTF_VectorTraits_h |
22 #define WTF_VectorTraits_h | 22 #define WTF_VectorTraits_h |
23 | 23 |
24 #include "wtf/OwnPtr.h" | 24 #include "wtf/OwnPtr.h" |
25 #include "wtf/RefPtr.h" | 25 #include "wtf/RefPtr.h" |
26 #include "wtf/TypeTraits.h" | 26 #include "wtf/TypeTraits.h" |
| 27 #include <type_traits> |
27 #include <utility> | 28 #include <utility> |
28 | 29 |
29 using std::pair; | 30 using std::pair; |
30 | 31 |
31 namespace WTF { | 32 namespace WTF { |
32 | 33 |
33 class AtomicString; | 34 class AtomicString; |
34 | 35 |
35 template<typename T> | 36 template<typename T> |
36 struct VectorTraitsBase | 37 struct VectorTraitsBase |
37 { | 38 { |
38 static const bool needsDestruction = !IsPod<T>::value; | 39 static const bool needsDestruction = !std::is_trivially_destructible<T>:
:value; |
39 static const bool canInitializeWithMemset = IsPod<T>::value; | 40 static const bool canInitializeWithMemset = std::is_pod<T>::value; |
40 static const bool canMoveWithMemcpy = IsPod<T>::value; | 41 static const bool canMoveWithMemcpy = std::is_pod<T>::value; |
41 static const bool canCopyWithMemcpy = IsPod<T>::value; | 42 static const bool canCopyWithMemcpy = std::is_pod<T>::value; |
42 static const bool canFillWithMemset = IsPod<T>::value && (sizeof(T) == s
izeof(char)); | 43 static const bool canFillWithMemset = std::is_pod<T>::value && (sizeof(T
) == sizeof(char)); |
43 static const bool canCompareWithMemcmp = IsPod<T>::value; | 44 static const bool canCompareWithMemcmp = std::is_pod<T>::value; |
44 template<typename U = void> | 45 template<typename U = void> |
45 struct NeedsTracingLazily { | 46 struct NeedsTracingLazily { |
46 static const bool value = NeedsTracing<T>::value; | 47 static const bool value = NeedsTracing<T>::value; |
47 }; | 48 }; |
48 static const WeakHandlingFlag weakHandlingFlag = NoWeakHandlingInCollect
ions; // We don't support weak handling in vectors. | 49 static const WeakHandlingFlag weakHandlingFlag = NoWeakHandlingInCollect
ions; // We don't support weak handling in vectors. |
49 }; | 50 }; |
50 | 51 |
51 template<typename T> | 52 template<typename T> |
52 struct VectorTraits : VectorTraitsBase<T> { }; | 53 struct VectorTraits : VectorTraitsBase<T> { }; |
53 | 54 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 struct VectorTraits<ClassName> : VectorTraitsBase<ClassName> \ | 115 struct VectorTraits<ClassName> : VectorTraitsBase<ClassName> \ |
115 { \ | 116 { \ |
116 static const bool canInitializeWithMemset = true; \ | 117 static const bool canInitializeWithMemset = true; \ |
117 }; \ | 118 }; \ |
118 } | 119 } |
119 | 120 |
120 using WTF::VectorTraits; | 121 using WTF::VectorTraits; |
121 using WTF::SimpleClassVectorTraits; | 122 using WTF::SimpleClassVectorTraits; |
122 | 123 |
123 #endif // WTF_VectorTraits_h | 124 #endif // WTF_VectorTraits_h |
OLD | NEW |