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

Unified Diff: base/callback_internal.h

Issue 1653023003: Specialize IsMoveOnlyType<T> for vectors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « base/bind_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/callback_internal.h
diff --git a/base/callback_internal.h b/base/callback_internal.h
index e4e538ff15c2d0dfe239bc5d8b17fe411c59926e..643ea324404615f401ad47482d1422ea2f980178 100644
--- a/base/callback_internal.h
+++ b/base/callback_internal.h
@@ -11,6 +11,7 @@
#include <stddef.h>
#include <memory>
#include <type_traits>
+#include <vector>
dcheng 2016/02/01 21:26:03 Unfortunately, doing this means more opportunities
#include "base/atomic_ref_count.h"
#include "base/base_export.h"
@@ -118,6 +119,14 @@ template <typename T> struct IsMoveOnlyType {
template <typename T, typename D>
struct IsMoveOnlyType<std::unique_ptr<T, D>> : std::true_type {};
+// Specialization of std::vector, so that it's considered move-only if the
+// element type is move-only.
+template <typename T, typename Allocator>
+struct IsMoveOnlyType<std::vector<T, Allocator>> {
+ static const bool value =
+ IsMoveOnlyType<typename std::vector<T, Allocator>::value_type>::value;
vmpstr 2016/02/01 21:36:16 FWIW, I think "typename std::vector<T, Allocator>:
dcheng 2016/02/01 22:16:54 The argument for using value_type is for consisten
+};
+
template <typename>
struct CallbackParamTraitsForMoveOnlyType;
« no previous file with comments | « base/bind_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698