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

Unified Diff: base/bind.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 | « no previous file | base/bind_helpers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bind.h
diff --git a/base/bind.h b/base/bind.h
index 94da5ac56a488f0fbd5b880f54705957591ac03b..644135f0775596f874baf737025b49fe03f32289 100644
--- a/base/bind.h
+++ b/base/bind.h
@@ -71,9 +71,9 @@ base::Callback<
typename internal::FunctorTraits<Functor>::RunnableType,
typename internal::FunctorTraits<Functor>::RunType,
internal::TypeList<
- typename internal::CallbackParamTraits<Args>::StorageType...>>
+ typename std::decay<Args>::type...>>
::UnboundRunType>
-Bind(Functor functor, const Args&... args) {
+Bind(Functor functor, Args&&... args) {
// Typedefs for how to store and run the functor.
typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
typedef typename internal::FunctorTraits<Functor>::RunType RunType;
@@ -105,12 +105,11 @@ Bind(Functor functor, const Args&... args) {
typedef internal::BindState<
RunnableType, RunType,
- internal::TypeList<
- typename internal::CallbackParamTraits<Args>::StorageType...>>
+ internal::TypeList<typename std::decay<Args>::type...>>
BindState;
- return Callback<typename BindState::UnboundRunType>(
- new BindState(internal::MakeRunnable(functor), args...));
+ return Callback<typename BindState::UnboundRunType>(new BindState(
+ internal::MakeRunnable(functor), std::forward<Args>(args)...));
}
} // namespace base
« no previous file with comments | « no previous file | base/bind_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698