Index: third_party/protobuf/src/google/protobuf/stubs/type_traits.h |
diff --git a/third_party/protobuf/src/google/protobuf/stubs/type_traits.h b/third_party/protobuf/src/google/protobuf/stubs/type_traits.h |
index 0d8127e504d4b16b146db499faa3c96f1686fb74..e41f5e6f6996b5d9cfda557103ccdf1a181918ff 100644 |
--- a/third_party/protobuf/src/google/protobuf/stubs/type_traits.h |
+++ b/third_party/protobuf/src/google/protobuf/stubs/type_traits.h |
@@ -35,7 +35,6 @@ |
// any changes here, make sure that you're not breaking any platforms. |
// |
// Define a small subset of tr1 type traits. The traits we define are: |
-// enable_if |
// is_integral |
// is_floating_point |
// is_pointer |
@@ -59,7 +58,6 @@ |
#ifndef GOOGLE_PROTOBUF_TYPE_TRAITS_H_ |
#define GOOGLE_PROTOBUF_TYPE_TRAITS_H_ |
-#include <cstddef> // for NULL |
#include <utility> // For pair |
#include <google/protobuf/stubs/template_util.h> // For true_type and false_type |
@@ -68,24 +66,6 @@ namespace google { |
namespace protobuf { |
namespace internal { |
-template<typename B, typename D> |
-struct is_base_of { |
- typedef char (&yes)[1]; |
- typedef char (&no)[2]; |
- |
- // BEGIN GOOGLE LOCAL MODIFICATION -- check is a #define on Mac. |
- #undef check |
- // END GOOGLE LOCAL MODIFICATION |
- |
- static yes check(const B*); |
- static no check(const void*); |
- |
- enum { |
- value = sizeof(check(static_cast<const D*>(NULL))) == sizeof(yes), |
- }; |
-}; |
- |
-template <bool cond, class T = void> struct enable_if; |
template <class T> struct is_integral; |
template <class T> struct is_floating_point; |
template <class T> struct is_pointer; |
@@ -107,17 +87,10 @@ template <class T> struct remove_reference; |
template <class T> struct add_reference; |
template <class T> struct remove_pointer; |
template <class T, class U> struct is_same; |
-#if !(defined(__GNUC__) && __GNUC__ <= 3) |
+#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) |
template <class From, class To> struct is_convertible; |
#endif |
-// enable_if, equivalent semantics to c++11 std::enable_if, specifically: |
-// "If B is true, the member typedef type shall equal T; otherwise, there |
-// shall be no member typedef type." |
-// Specified by 20.9.7.6 [Other transformations] |
- |
-template<bool cond, class T> struct enable_if { typedef T type; }; |
-template<class T> struct enable_if<false, T> {}; |
// is_integral is false except for the built-in integer types. A |
// cv-qualified type is integral if and only if the underlying type is. |
template <class T> struct is_integral : false_type { }; |
@@ -171,7 +144,7 @@ template <class T> struct is_pointer<const volatile T> : is_pointer<T> { }; |
#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) |
-namespace type_traits_internal { |
+namespace internal { |
template <class T> struct is_class_or_union { |
template <class U> static small_ tester(void (U::*)()); |
@@ -186,7 +159,7 @@ template <bool NotUnum, class T> struct is_enum_impl |
template <class T> struct is_enum_impl<true, T> : false_type { }; |
-} // namespace type_traits_internal |
+} // namespace internal |
// Specified by TR1 [4.5.1] primary type categories. |
@@ -204,12 +177,12 @@ template <class T> struct is_enum_impl<true, T> : false_type { }; |
// because it can't be used with some types (e.g. void or classes with |
// inaccessible conversion operators). |
template <class T> struct is_enum |
- : type_traits_internal::is_enum_impl< |
+ : internal::is_enum_impl< |
is_same<T, void>::value || |
is_integral<T>::value || |
is_floating_point<T>::value || |
is_reference<T>::value || |
- type_traits_internal::is_class_or_union<T>::value, |
+ internal::is_class_or_union<T>::value, |
T> { }; |
template <class T> struct is_enum<const T> : is_enum<T> { }; |
@@ -326,8 +299,8 @@ template<typename T, typename U> struct is_same : public false_type { }; |
template<typename T> struct is_same<T, T> : public true_type { }; |
// Specified by TR1 [4.6] Relationships between types |
-#if !(defined(__GNUC__) && __GNUC__ <= 3) |
-namespace type_traits_internal { |
+#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) |
+namespace internal { |
// This class is an implementation detail for is_convertible, and you |
// don't need to know how it works to use is_convertible. For those |
@@ -343,17 +316,16 @@ struct ConvertHelper { |
static small_ Test(To); |
static big_ Test(...); |
static From Create(); |
- enum { |
- value = sizeof(Test(Create())) == sizeof(small_) |
- }; |
}; |
-} // namespace type_traits_internal |
+} // namespace internal |
// Inherits from true_type if From is convertible to To, false_type otherwise. |
template <typename From, typename To> |
struct is_convertible |
: integral_constant<bool, |
- type_traits_internal::ConvertHelper<From, To>::value> { |
+ sizeof(internal::ConvertHelper<From, To>::Test( |
+ internal::ConvertHelper<From, To>::Create())) |
+ == sizeof(small_)> { |
}; |
#endif |