Lines 26-31
Link Here
|
26 |
|
26 |
|
27 |
#if (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600)) |
27 |
#if (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600)) |
28 |
#include <type_traits> |
28 |
#include <type_traits> |
|
|
29 |
#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__) |
30 |
#include <tr1/memory> |
31 |
#endif |
29 |
#endif |
32 |
#endif |
30 |
|
33 |
|
31 |
namespace WTF { |
34 |
namespace WTF { |
Lines 166-178
Link Here
|
166 |
typedef T Type; |
169 |
typedef T Type; |
167 |
}; |
170 |
}; |
168 |
|
171 |
|
169 |
#if (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600)) |
172 |
#if COMPILER(CLANG) || GCC_VERSION_AT_LEAST(4, 6, 0) || (defined(_MSC_VER) && (_MSC_VER >= 1400) && (_MSC_VER < 1600) && !defined(__INTEL_COMPILER)) |
170 |
|
173 |
// VC8 (VS2005) and later has __has_trivial_constructor and __has_trivial_destructor, |
|
|
174 |
// but the implementation returns false for built-in types. We add the extra IsPod condition to |
175 |
// work around this. |
176 |
template <typename T> struct HasTrivialConstructor { |
177 |
static const bool value = __has_trivial_constructor(T) || IsPod<RemoveConstVolatile<T> >::value; |
178 |
}; |
179 |
template <typename T> struct HasTrivialDestructor { |
180 |
static const bool value = __has_trivial_destructor(T) || IsPod<RemoveConstVolatile<T> >::value; |
181 |
}; |
182 |
#elif (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600)) |
171 |
// GCC's libstdc++ 20070724 and later supports C++ TR1 type_traits in the std namespace. |
183 |
// GCC's libstdc++ 20070724 and later supports C++ TR1 type_traits in the std namespace. |
172 |
// VC10 (VS2010) and later support C++ TR1 type_traits in the std::tr1 namespace. |
184 |
// VC10 (VS2010) and later support C++ TR1 type_traits in the std::tr1 namespace. |
173 |
template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { }; |
185 |
template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { }; |
174 |
template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { }; |
186 |
template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { }; |
175 |
|
|
|
176 |
#else |
187 |
#else |
177 |
|
188 |
|
178 |
// This compiler doesn't provide type traits, so we provide basic HasTrivialConstructor |
189 |
// This compiler doesn't provide type traits, so we provide basic HasTrivialConstructor |
Lines 189-203
Link Here
|
189 |
typedef IntegralConstant<bool, true> true_type; |
200 |
typedef IntegralConstant<bool, true> true_type; |
190 |
typedef IntegralConstant<bool, false> false_type; |
201 |
typedef IntegralConstant<bool, false> false_type; |
191 |
|
202 |
|
192 |
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) |
|
|
193 |
// VC8 (VS2005) and later have built-in compiler support for HasTrivialConstructor / HasTrivialDestructor, |
194 |
// but for some unexplained reason it doesn't work on built-in types. |
195 |
template <typename T> struct HasTrivialConstructor : public IntegralConstant<bool, __has_trivial_constructor(T)>{ }; |
196 |
template <typename T> struct HasTrivialDestructor : public IntegralConstant<bool, __has_trivial_destructor(T)>{ }; |
197 |
#else |
198 |
template <typename T> struct HasTrivialConstructor : public false_type{ }; |
203 |
template <typename T> struct HasTrivialConstructor : public false_type{ }; |
199 |
template <typename T> struct HasTrivialDestructor : public false_type{ }; |
204 |
template <typename T> struct HasTrivialDestructor : public false_type{ }; |
200 |
#endif |
|
|
201 |
|
205 |
|
202 |
template <typename T> struct HasTrivialConstructor<T*> : public true_type{ }; |
206 |
template <typename T> struct HasTrivialConstructor<T*> : public true_type{ }; |
203 |
template <typename T> struct HasTrivialDestructor<T*> : public true_type{ }; |
207 |
template <typename T> struct HasTrivialDestructor<T*> : public true_type{ }; |