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

Unified Diff: mojo/public/cpp/bindings/lib/bindings_internal.h

Issue 1395533005: Use <type_traits> in the C++ bindings library wherever possible. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/lib/bindings_internal.h
diff --git a/mojo/public/cpp/bindings/lib/bindings_internal.h b/mojo/public/cpp/bindings/lib/bindings_internal.h
index e0a3939221fdb76e04484e530eaaffd8860c0d44..a36fdc3a7046037078e950c138f675ad38dd0cea 100644
--- a/mojo/public/cpp/bindings/lib/bindings_internal.h
+++ b/mojo/public/cpp/bindings/lib/bindings_internal.h
@@ -5,6 +5,8 @@
#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
#define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_INTERNAL_H_
+#include <type_traits>
+
#include "mojo/public/cpp/bindings/lib/template_util.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "mojo/public/cpp/system/core.h"
@@ -86,7 +88,7 @@ T FetchAndReset(T* ptr) {
template <typename H>
struct IsHandle {
- enum { value = IsBaseOf<Handle, H>::value };
+ enum { value = std::is_base_of<Handle, H>::value };
};
template <typename T>
@@ -149,7 +151,7 @@ struct IsUnionWrapperType {
static NoType Test(...);
static const bool value =
- sizeof(Test<T>(0)) == sizeof(YesType) && !IsConst<T>::value;
+ sizeof(Test<T>(0)) == sizeof(YesType) && !std::is_const<T>::value;
};
template <typename T>
@@ -161,7 +163,7 @@ struct IsUnionDataType {
static NoType Test(...);
static const bool value =
- sizeof(Test<T>(0)) == sizeof(YesType) && !IsConst<T>::value;
+ sizeof(Test<T>(0)) == sizeof(YesType) && !std::is_const<T>::value;
};
template <typename T,
@@ -205,12 +207,12 @@ struct ValueTraits {
};
template <typename T>
-struct ValueTraits<
- T,
- typename EnableIf<IsSpecializationOf<Array, T>::value ||
- IsSpecializationOf<Map, T>::value ||
- IsSpecializationOf<StructPtr, T>::value ||
- IsSpecializationOf<InlinedStructPtr, T>::value>::type> {
+struct ValueTraits<T,
+ typename std::enable_if<
+ IsSpecializationOf<Array, T>::value ||
+ IsSpecializationOf<Map, T>::value ||
+ IsSpecializationOf<StructPtr, T>::value ||
+ IsSpecializationOf<InlinedStructPtr, T>::value>::type> {
static bool Equals(const T& a, const T& b) { return a.Equals(b); }
};
« no previous file with comments | « mojo/public/cpp/bindings/lib/array_serialization.h ('k') | mojo/public/cpp/bindings/lib/map_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698