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

Unified Diff: webrtc/base/template_util.h

Issue 2719683002: Rewrite rtc::Bind using variadic templates. (Closed)
Patch Set: Mention where sequence_generator comes from in a comment. Created 3 years, 10 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 | « webrtc/base/bind_unittest.cc ('k') | webrtc/pc/ortcfactory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/template_util.h
diff --git a/webrtc/base/template_util.h b/webrtc/base/template_util.h
index 31464cf35db5d4047a7b8d95cb50246b8a23c0df..f3565a4c91ed792ac977eb8cffcaf67b04d13653 100644
--- a/webrtc/base/template_util.h
+++ b/webrtc/base/template_util.h
@@ -48,17 +48,17 @@ template <class T> struct is_non_const_reference<const T&> : false_type {};
template <class T> struct is_void : false_type {};
template <> struct is_void<void> : true_type {};
-template <class T>
-struct remove_reference {
- typedef T type;
-};
-template <class T>
-struct remove_reference<T&> {
- typedef T type;
-};
-template <class T>
-struct remove_reference<T&&> {
- typedef T type;
+// Helper useful for converting a tuple to variadic template function
+// arguments.
+//
+// sequence_generator<3>::type will be sequence<0, 1, 2>.
+template <int...>
+struct sequence {};
+template <int N, int... S>
+struct sequence_generator : sequence_generator<N - 1, N - 1, S...> {};
+template <int... S>
+struct sequence_generator<0, S...> {
+ typedef sequence<S...> type;
};
namespace internal {
« no previous file with comments | « webrtc/base/bind_unittest.cc ('k') | webrtc/pc/ortcfactory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698