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

Unified Diff: base/template_util.h

Issue 1498973002: WIP: base::Bind for rvalue references. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « base/callback_internal.h ('k') | media/base/stream_parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/template_util.h
diff --git a/base/template_util.h b/base/template_util.h
index 83fa322a67226d512b6a6b3974b76637ee2ffbc7..27e540a9c51b38cc72268c8abcc54a84f78064a9 100644
--- a/base/template_util.h
+++ b/base/template_util.h
@@ -6,6 +6,7 @@
#define BASE_TEMPLATE_UTIL_H_
#include <cstddef> // For size_t.
+#include <type_traits>
#include "build/build_config.h"
@@ -56,6 +57,18 @@ template <class T> struct is_const<const T> : true_type {};
template <class T> struct is_void : false_type {};
template <> struct is_void<void> : true_type {};
+template <typename T>
+struct is_move_constructible : public std::is_constructible<T, T&&> {};
+
+template <typename T>
+struct is_copy_constructible : public std::is_constructible<T, const T&> {};
+
+template <typename T>
+struct is_move_only
+ : public std::conditional<!is_copy_constructible<T>::value,
+ typename is_move_constructible<T>::type,
+ std::false_type>::type {};
+
namespace internal {
// Types YesType and NoType are guaranteed such that sizeof(YesType) <
« no previous file with comments | « base/callback_internal.h ('k') | media/base/stream_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698