[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: [email protected]
Reviewed-on: https://chromium-review.googlesource.com/616082
Reviewed-by: Jeremy Roman <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Commit-Queue: Jeremy Roman <[email protected]>
Cr-Commit-Position: refs/heads/master@{#494802}
diff --git a/base/bind_internal.h b/base/bind_internal.h
index 80616b0..185e00d 100644
--- a/base/bind_internal.h
+++ b/base/bind_internal.h
@@ -7,15 +7,14 @@
 
 #include <stddef.h>
 
-#include <tuple>
 #include <type_traits>
+#include <utility>
 
 #include "base/bind_helpers.h"
 #include "base/callback_internal.h"
 #include "base/memory/raw_scoped_refptr_mismatch_checker.h"
 #include "base/memory/weak_ptr.h"
 #include "base/template_util.h"
-#include "base/tuple.h"
 #include "build/build_config.h"
 
 namespace base {
@@ -305,7 +304,7 @@
         std::tuple_size<decltype(storage->bound_args_)>::value;
     return RunImpl(std::move(storage->functor_),
                    std::move(storage->bound_args_),
-                   MakeIndexSequence<num_bound_args>(),
+                   std::make_index_sequence<num_bound_args>(),
                    std::forward<UnboundArgs>(unbound_args)...);
   }
 
@@ -316,9 +315,8 @@
     const StorageType* storage = static_cast<StorageType*>(base);
     static constexpr size_t num_bound_args =
         std::tuple_size<decltype(storage->bound_args_)>::value;
-    return RunImpl(storage->functor_,
-                   storage->bound_args_,
-                   MakeIndexSequence<num_bound_args>(),
+    return RunImpl(storage->functor_, storage->bound_args_,
+                   std::make_index_sequence<num_bound_args>(),
                    std::forward<UnboundArgs>(unbound_args)...);
   }
 
@@ -326,7 +324,7 @@
   template <typename Functor, typename BoundArgsTuple, size_t... indices>
   static inline R RunImpl(Functor&& functor,
                           BoundArgsTuple&& bound,
-                          IndexSequence<indices...>,
+                          std::index_sequence<indices...>,
                           UnboundArgs&&... unbound_args) {
     static constexpr bool is_method = MakeFunctorTraits<Functor>::is_method;
 
@@ -389,7 +387,7 @@
 template <typename Functor, typename BoundArgsTuple, size_t... indices>
 bool ApplyCancellationTraitsImpl(const Functor& functor,
                                  const BoundArgsTuple& bound_args,
-                                 IndexSequence<indices...>) {
+                                 std::index_sequence<indices...>) {
   return CallbackCancellationTraits<Functor, BoundArgsTuple>::IsCancelled(
       functor, std::get<indices>(bound_args)...);
 }
@@ -401,8 +399,9 @@
   const BindStateType* storage = static_cast<const BindStateType*>(base);
   static constexpr size_t num_bound_args =
       std::tuple_size<decltype(storage->bound_args_)>::value;
-  return ApplyCancellationTraitsImpl(storage->functor_, storage->bound_args_,
-                                     MakeIndexSequence<num_bound_args>());
+  return ApplyCancellationTraitsImpl(
+      storage->functor_, storage->bound_args_,
+      std::make_index_sequence<num_bound_args>());
 };
 
 // Template helpers to detect using Bind() on a base::Callback without any