Index: base/bind_helpers.h |
diff --git a/base/bind_helpers.h b/base/bind_helpers.h |
index 24063ad1ce58fd27c5535ec81c294c597db841df..370dac8a42f299f5d4454116ee87c2b9d9420557 100644 |
--- a/base/bind_helpers.h |
+++ b/base/bind_helpers.h |
@@ -384,11 +384,31 @@ class PassedWrapper { |
// Unwrap the stored parameters for the wrappers above. |
template <typename T> |
-struct UnwrapTraits { |
+struct MoveOnlyUnwrapTraits { |
+ typedef T&& ForwardType; |
+ static ForwardType Unwrap(T& o) { return std::move(o); } |
+}; |
+ |
+template <typename T> |
+struct CopyUnwrapTraits { |
typedef const T& ForwardType; |
static ForwardType Unwrap(const T& o) { return o; } |
}; |
+// BindState<> |
+template <typename T, typename U = void> |
+struct UnwrapTraits : public std::conditional<base::is_move_only<T>::value, |
+ MoveOnlyUnwrapTraits<T>, |
+ CopyUnwrapTraits<T>>::type {}; |
+ |
+template <typename T> |
+struct UnwrapTraits< |
+ T, |
+ typename std::conditional<false, typename T::value_type, void>::type> |
+ : public std::conditional<base::is_move_only<typename T::value_type>::value, |
+ MoveOnlyUnwrapTraits<T>, |
+ CopyUnwrapTraits<T>>::type {}; |
+ |
template <typename T> |
struct UnwrapTraits<UnretainedWrapper<T> > { |
typedef T* ForwardType; |