[gtest] Use std::index_sequence and friends instead of rolling our own
				
					
				
			* Applies for `std::index_sequence`, `std::make_index_sequence`, and `std::index_sequence_for` replacing `IndexSequence`, `MakeIndexSequence` and IndexSequenceFor` * Also deleted implementation helper `DoubleSequence` * The standard interfaces [have been in the standard library since C++14](https://en.cppreference.com/w/cpp/utility/integer_sequence), which [is the minimum supported C++ version by Google Test](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md) PiperOrigin-RevId: 621939977 Change-Id: Id264266f08da66c0fa2a6e6fbb8f86fd3cb3a421
This commit is contained in:
		
				
					committed by
					
						
						Copybara-Service
					
				
			
			
				
	
			
			
			
						parent
						
							61db1e1740
						
					
				
				
					commit
					0af976647f
				
			@@ -44,6 +44,7 @@
 | 
			
		||||
#include <ostream>  // NOLINT
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <type_traits>
 | 
			
		||||
#include <utility>
 | 
			
		||||
#include <vector>
 | 
			
		||||
 | 
			
		||||
#include "gmock/internal/gmock-port.h"
 | 
			
		||||
@@ -420,7 +421,7 @@ struct RemoveConstFromKey<std::pair<const K, V> > {
 | 
			
		||||
GTEST_API_ void IllegalDoDefault(const char* file, int line);
 | 
			
		||||
 | 
			
		||||
template <typename F, typename Tuple, size_t... Idx>
 | 
			
		||||
auto ApplyImpl(F&& f, Tuple&& args, IndexSequence<Idx...>)
 | 
			
		||||
auto ApplyImpl(F&& f, Tuple&& args, std::index_sequence<Idx...>)
 | 
			
		||||
    -> decltype(std::forward<F>(f)(
 | 
			
		||||
        std::get<Idx>(std::forward<Tuple>(args))...)) {
 | 
			
		||||
  return std::forward<F>(f)(std::get<Idx>(std::forward<Tuple>(args))...);
 | 
			
		||||
@@ -428,12 +429,13 @@ auto ApplyImpl(F&& f, Tuple&& args, IndexSequence<Idx...>)
 | 
			
		||||
 | 
			
		||||
// Apply the function to a tuple of arguments.
 | 
			
		||||
template <typename F, typename Tuple>
 | 
			
		||||
auto Apply(F&& f, Tuple&& args) -> decltype(ApplyImpl(
 | 
			
		||||
    std::forward<F>(f), std::forward<Tuple>(args),
 | 
			
		||||
    MakeIndexSequence<std::tuple_size<
 | 
			
		||||
        typename std::remove_reference<Tuple>::type>::value>())) {
 | 
			
		||||
auto Apply(F&& f, Tuple&& args)
 | 
			
		||||
    -> decltype(ApplyImpl(
 | 
			
		||||
        std::forward<F>(f), std::forward<Tuple>(args),
 | 
			
		||||
        std::make_index_sequence<std::tuple_size<
 | 
			
		||||
            typename std::remove_reference<Tuple>::type>::value>())) {
 | 
			
		||||
  return ApplyImpl(std::forward<F>(f), std::forward<Tuple>(args),
 | 
			
		||||
                   MakeIndexSequence<std::tuple_size<
 | 
			
		||||
                   std::make_index_sequence<std::tuple_size<
 | 
			
		||||
                       typename std::remove_reference<Tuple>::type>::value>());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user