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

Unified Diff: base/bind_helpers.h

Issue 1512833002: Remove unbound base::Bind overload (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge back 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/bind.h ('k') | base/bind_internal.h » ('j') | base/bind_internal.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bind_helpers.h
diff --git a/base/bind_helpers.h b/base/bind_helpers.h
index 434520ac2b2cfce4fc2b34005fe4e5b827536f6e..067f8ed7f711005128c8b6593bbe09f6102a8c00 100644
--- a/base/bind_helpers.h
+++ b/base/bind_helpers.h
@@ -527,6 +527,29 @@ struct DropTypeListItemImpl<0, TypeList<>> {
template <size_t n, typename List>
using DropTypeListItem = typename DropTypeListItemImpl<n, List>::Type;
+// Used for TakeTypeListItem implementation.
+template <size_t n, typename List, typename... Accum>
+struct TakeTypeListItemImpl;
+
+// Do not use enable_if and SFINAE here to avoid MSVC2013 compile failure.
+template <size_t n, typename T, typename... List, typename... Accum>
+struct TakeTypeListItemImpl<n, TypeList<T, List...>, Accum...>
+ : TakeTypeListItemImpl<n - 1, TypeList<List...>, Accum..., T> {};
+
+template <typename T, typename... List, typename... Accum>
+struct TakeTypeListItemImpl<0, TypeList<T, List...>, Accum...> {
+ typedef TypeList<Accum...> Type;
dcheng 2015/12/14 19:26:46 Let's do using Type = TypeList<Accum...>;
tzik 2015/12/15 05:55:09 Done.
+};
+
+template <typename... Accum>
+struct TakeTypeListItemImpl<0, TypeList<>, Accum...> {
+ typedef TypeList<Accum...> Type;
+};
+
+// A type-level function that takes first |n| list item from given TypeList.
dcheng 2015/12/14 19:26:46 Can this comment include an example input and the
tzik 2015/12/15 05:55:09 Done.
+template <size_t n, typename List>
+using TakeTypeListItem = typename TakeTypeListItemImpl<n, List>::Type;
+
// Used for ConcatTypeLists implementation.
template <typename List1, typename List2>
struct ConcatTypeListsImpl;
@@ -554,6 +577,19 @@ struct MakeFunctionTypeImpl<R, TypeList<Args...>> {
template <typename R, typename ArgList>
using MakeFunctionType = typename MakeFunctionTypeImpl<R, ArgList>::Type;
+// Used for ExtractArgs.
+template <typename Signature>
+struct ExtractArgsImpl;
+
+template <typename R, typename... Args>
+struct ExtractArgsImpl<R(Args...)> {
+ using Type = TypeList<Args...>;
+};
+
+// A type-level function that extracts function arguments into a TypeList.
dcheng 2015/12/14 19:26:46 Ditto: Input: R(A1, A2, A3) => TypeList<A1, A2, A
tzik 2015/12/15 05:55:09 Done.
+template <typename Signature>
+using ExtractArgs = typename ExtractArgsImpl<Signature>::Type;
+
} // namespace internal
template <typename T>
« no previous file with comments | « base/bind.h ('k') | base/bind_internal.h » ('j') | base/bind_internal.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698