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

Unified Diff: base/template_util.h

Issue 598223003: Update base::is_member_function_pointer to use variadic templates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comment Created 6 years, 3 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 | « no previous file | base/template_util_unittest.cc » ('j') | base/template_util_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/template_util.h
diff --git a/base/template_util.h b/base/template_util.h
index f4bf7461327bcb076bbe4bbf30bdd405f9bf3234..83fa322a67226d512b6a6b3974b76637ee2ffbc7 100644
--- a/base/template_util.h
+++ b/base/template_util.h
@@ -28,37 +28,15 @@ typedef integral_constant<bool, false> false_type;
template <class T> struct is_pointer : false_type {};
template <class T> struct is_pointer<T*> : true_type {};
-// Member function pointer detection up to four params. Add more as needed
-// below. This is built-in to C++ 11, and we can remove this when we switch.
+// Member function pointer detection. This is built-in to C++ 11's stdlib, and
+// we can remove this when we switch to it.
template<typename T>
struct is_member_function_pointer : false_type {};
-template <typename R, typename Z>
-struct is_member_function_pointer<R(Z::*)()> : true_type {};
-template <typename R, typename Z>
-struct is_member_function_pointer<R(Z::*)() const> : true_type {};
-
-template <typename R, typename Z, typename A>
-struct is_member_function_pointer<R(Z::*)(A)> : true_type {};
-template <typename R, typename Z, typename A>
-struct is_member_function_pointer<R(Z::*)(A) const> : true_type {};
-
-template <typename R, typename Z, typename A, typename B>
-struct is_member_function_pointer<R(Z::*)(A, B)> : true_type {};
-template <typename R, typename Z, typename A, typename B>
-struct is_member_function_pointer<R(Z::*)(A, B) const> : true_type {};
-
-template <typename R, typename Z, typename A, typename B, typename C>
-struct is_member_function_pointer<R(Z::*)(A, B, C)> : true_type {};
-template <typename R, typename Z, typename A, typename B, typename C>
-struct is_member_function_pointer<R(Z::*)(A, B, C) const> : true_type {};
-
-template <typename R, typename Z, typename A, typename B, typename C,
- typename D>
-struct is_member_function_pointer<R(Z::*)(A, B, C, D)> : true_type {};
-template <typename R, typename Z, typename A, typename B, typename C,
- typename D>
-struct is_member_function_pointer<R(Z::*)(A, B, C, D) const> : true_type {};
+template <typename R, typename Z, typename... A>
+struct is_member_function_pointer<R(Z::*)(A...)> : true_type {};
+template <typename R, typename Z, typename... A>
+struct is_member_function_pointer<R(Z::*)(A...) const> : true_type {};
template <class T, class U> struct is_same : public false_type {};
« no previous file with comments | « no previous file | base/template_util_unittest.cc » ('j') | base/template_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698