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 |
(...skipping 28 matching lines...) Expand all Loading... |
39 template<typename T> | 39 template<typename T> |
40 struct VectorTraitsBase<false, T> | 40 struct VectorTraitsBase<false, T> |
41 { | 41 { |
42 static const bool needsDestruction = true; | 42 static const bool needsDestruction = true; |
43 static const bool needsInitialization = true; | 43 static const bool needsInitialization = true; |
44 static const bool canInitializeWithMemset = false; | 44 static const bool canInitializeWithMemset = false; |
45 static const bool canMoveWithMemcpy = false; | 45 static const bool canMoveWithMemcpy = false; |
46 static const bool canCopyWithMemcpy = false; | 46 static const bool canCopyWithMemcpy = false; |
47 static const bool canFillWithMemset = false; | 47 static const bool canFillWithMemset = false; |
48 static const bool canCompareWithMemcmp = false; | 48 static const bool canCompareWithMemcmp = false; |
49 static const bool needsVisiting = NeedsVisiting<T>::value; | 49 static const bool needsTracing = NeedsTracing<T>::value; |
50 static const bool isWeak = IsWeak<T>::value; | 50 static const bool isWeak = IsWeak<T>::value; |
51 }; | 51 }; |
52 | 52 |
53 template<typename T> | 53 template<typename T> |
54 struct VectorTraitsBase<true, T> | 54 struct VectorTraitsBase<true, T> |
55 { | 55 { |
56 static const bool needsDestruction = false; | 56 static const bool needsDestruction = false; |
57 static const bool needsInitialization = false; | 57 static const bool needsInitialization = false; |
58 static const bool canInitializeWithMemset = false; | 58 static const bool canInitializeWithMemset = false; |
59 static const bool canMoveWithMemcpy = true; | 59 static const bool canMoveWithMemcpy = true; |
60 static const bool canCopyWithMemcpy = true; | 60 static const bool canCopyWithMemcpy = true; |
61 static const bool canFillWithMemset = sizeof(T) == sizeof(char); | 61 static const bool canFillWithMemset = sizeof(T) == sizeof(char); |
62 static const bool canCompareWithMemcmp = true; | 62 static const bool canCompareWithMemcmp = true; |
63 static const bool needsVisiting = NeedsVisiting<T>::value; | 63 static const bool needsTracing = NeedsTracing<T>::value; |
64 static const bool isWeak = IsWeak<T>::value; | 64 static const bool isWeak = IsWeak<T>::value; |
65 }; | 65 }; |
66 | 66 |
67 template<typename T> | 67 template<typename T> |
68 struct VectorTraits : VectorTraitsBase<IsPod<T>::value, T> { }; | 68 struct VectorTraits : VectorTraitsBase<IsPod<T>::value, T> { }; |
69 | 69 |
70 struct SimpleClassVectorTraits : VectorTraitsBase<false, void> | 70 struct SimpleClassVectorTraits : VectorTraitsBase<false, void> |
71 { | 71 { |
72 static const bool canInitializeWithMemset = true; | 72 static const bool canInitializeWithMemset = true; |
73 static const bool canMoveWithMemcpy = true; | 73 static const bool canMoveWithMemcpy = true; |
(...skipping 17 matching lines...) Expand all Loading... |
91 typedef VectorTraits<First> FirstTraits; | 91 typedef VectorTraits<First> FirstTraits; |
92 typedef VectorTraits<Second> SecondTraits; | 92 typedef VectorTraits<Second> SecondTraits; |
93 | 93 |
94 static const bool needsDestruction = FirstTraits::needsDestruction || Se
condTraits::needsDestruction; | 94 static const bool needsDestruction = FirstTraits::needsDestruction || Se
condTraits::needsDestruction; |
95 static const bool needsInitialization = FirstTraits::needsInitialization
|| SecondTraits::needsInitialization; | 95 static const bool needsInitialization = FirstTraits::needsInitialization
|| SecondTraits::needsInitialization; |
96 static const bool canInitializeWithMemset = FirstTraits::canInitializeWi
thMemset && SecondTraits::canInitializeWithMemset; | 96 static const bool canInitializeWithMemset = FirstTraits::canInitializeWi
thMemset && SecondTraits::canInitializeWithMemset; |
97 static const bool canMoveWithMemcpy = FirstTraits::canMoveWithMemcpy &&
SecondTraits::canMoveWithMemcpy; | 97 static const bool canMoveWithMemcpy = FirstTraits::canMoveWithMemcpy &&
SecondTraits::canMoveWithMemcpy; |
98 static const bool canCopyWithMemcpy = FirstTraits::canCopyWithMemcpy &&
SecondTraits::canCopyWithMemcpy; | 98 static const bool canCopyWithMemcpy = FirstTraits::canCopyWithMemcpy &&
SecondTraits::canCopyWithMemcpy; |
99 static const bool canFillWithMemset = false; | 99 static const bool canFillWithMemset = false; |
100 static const bool canCompareWithMemcmp = FirstTraits::canCompareWithMemc
mp && SecondTraits::canCompareWithMemcmp; | 100 static const bool canCompareWithMemcmp = FirstTraits::canCompareWithMemc
mp && SecondTraits::canCompareWithMemcmp; |
101 static const bool needsVisiting = FirstTraits::needsVisiting || SecondTr
aits::needsVisiting; | 101 static const bool needsTracing = FirstTraits::needsTracing || SecondTrai
ts::needsTracing; |
102 static const bool isWeak = FirstTraits::isWeak || SecondTraits::isWeak; | 102 static const bool isWeak = FirstTraits::isWeak || SecondTraits::isWeak; |
103 }; | 103 }; |
104 | 104 |
105 } // namespace WTF | 105 } // namespace WTF |
106 | 106 |
107 using WTF::VectorTraits; | 107 using WTF::VectorTraits; |
108 using WTF::SimpleClassVectorTraits; | 108 using WTF::SimpleClassVectorTraits; |
109 | 109 |
110 #endif // WTF_VectorTraits_h | 110 #endif // WTF_VectorTraits_h |
OLD | NEW |