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

Unified Diff: base/bind.h

Issue 1512833002: Remove unbound base::Bind overload (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix 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') | base/bind_unittest.cc » ('J')
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 9b55924d253ea2ae4d9479b98fe493d8d17615fe..4c2abed7e71c7d6efc1ab14d24d3d7f82c69ecab 100644
--- a/base/bind.h
+++ b/base/bind.h
@@ -47,22 +47,6 @@
namespace base {
-template <typename Functor>
-base::Callback<
- typename internal::BindState<
- typename internal::FunctorTraits<Functor>::RunnableType,
- typename internal::FunctorTraits<Functor>::RunType>::UnboundRunType>
-Bind(Functor functor) {
- // Typedefs for how to store and run the functor.
- typedef typename internal::FunctorTraits<Functor>::RunnableType RunnableType;
- typedef typename internal::FunctorTraits<Functor>::RunType RunType;
-
- typedef internal::BindState<RunnableType, RunType> BindState;
-
- return Callback<typename BindState::UnboundRunType>(
- new BindState(internal::MakeRunnable(functor)));
-}
-
template <typename Functor, typename... Args>
base::Callback<
typename internal::BindState<
@@ -80,12 +64,16 @@ Bind(Functor functor, const Args&... args) {
// functor is going to interpret the argument as.
typedef typename RunnableType::RunType BoundRunType;
danakj 2015/12/16 20:01:42 nit: maybe consider writing these typedefs with "u
tzik 2015/12/17 01:42:36 ditto
+ using BoundArgs =
+ internal::TakeTypeListItem<sizeof...(Args),
+ internal::ExtractArgs<BoundRunType>>;
+
// Do not allow binding a non-const reference parameter. Non-const reference
// parameters are disallowed by the Google style guide. Also, binding a
// non-const reference parameter can make for subtle bugs because the
// invoked function will receive a reference to the stored copy of the
// argument and not the original.
- static_assert(!internal::HasNonConstReferenceParam<BoundRunType>::value,
+ static_assert(!internal::HasNonConstReferenceItem<BoundArgs>::value,
"do not bind functions with nonconst ref");
const bool is_method = internal::HasIsMethodTag<RunnableType>::value;
« no previous file with comments | « no previous file | base/bind_helpers.h » ('j') | base/bind_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698