[go: nahoru, domu]

[c++] Whitelist std::integer_sequence and replace base::IndexSequence with std::index_sequence.

The helper base::MakeIndexSequenceForTuple doesn't have a drop-in replacement
in the STL (std::index_sequence_for takes a parameter pack), so it has been
kept.

Bug: 554717
Change-Id: Ib38ea21855cd5c0f913727282a3603dc05287000
Tbr: jam@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/616082
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#494802}
diff --git a/base/bind.h b/base/bind.h
index a8dcdfc..c291fb4 100644
--- a/base/bind.h
+++ b/base/bind.h
@@ -5,6 +5,8 @@
 #ifndef BASE_BIND_H_
 #define BASE_BIND_H_
 
+#include <utility>
+
 #include "base/bind_internal.h"
 
 // -----------------------------------------------------------------------------
@@ -55,7 +57,7 @@
           typename... Args,
           typename... Unwrapped,
           typename... Params>
-struct AssertBindArgsValidity<IndexSequence<Ns...>,
+struct AssertBindArgsValidity<std::index_sequence<Ns...>,
                               TypeList<Args...>,
                               TypeList<Unwrapped...>,
                               TypeList<Params...>>
@@ -141,11 +143,10 @@
       internal::MakeUnwrappedTypeList<internal::RepeatMode::Once,
                                       FunctorTraits::is_method, Args&&...>;
   using BoundParamsList = typename Helper::BoundParamsList;
-  static_assert(
-      internal::AssertBindArgsValidity<MakeIndexSequence<Helper::num_bounds>,
-                                       BoundArgsList, UnwrappedArgsList,
-                                       BoundParamsList>::ok,
-      "The bound args need to be convertible to the target params.");
+  static_assert(internal::AssertBindArgsValidity<
+                    std::make_index_sequence<Helper::num_bounds>, BoundArgsList,
+                    UnwrappedArgsList, BoundParamsList>::ok,
+                "The bound args need to be convertible to the target params.");
 
   using BindState = internal::MakeBindStateType<Functor, Args...>;
   using UnboundRunType = MakeUnboundRunType<Functor, Args...>;
@@ -183,11 +184,10 @@
       internal::MakeUnwrappedTypeList<internal::RepeatMode::Repeating,
                                       FunctorTraits::is_method, Args&&...>;
   using BoundParamsList = typename Helper::BoundParamsList;
-  static_assert(
-      internal::AssertBindArgsValidity<MakeIndexSequence<Helper::num_bounds>,
-                                       BoundArgsList, UnwrappedArgsList,
-                                       BoundParamsList>::ok,
-      "The bound args need to be convertible to the target params.");
+  static_assert(internal::AssertBindArgsValidity<
+                    std::make_index_sequence<Helper::num_bounds>, BoundArgsList,
+                    UnwrappedArgsList, BoundParamsList>::ok,
+                "The bound args need to be convertible to the target params.");
 
   using BindState = internal::MakeBindStateType<Functor, Args...>;
   using UnboundRunType = MakeUnboundRunType<Functor, Args...>;