From e2c06aa2497e330bab1c1a03d02f7c5096eb5b0b Mon Sep 17 00:00:00 2001 From: Krystian Kuzniarek Date: Tue, 13 Aug 2019 23:12:51 +0200 Subject: [PATCH] remove a custom implementation of std::iterator_traits --- googletest/include/gtest/gtest-param-test.h | 6 +++--- .../include/gtest/internal/gtest-port.h | 21 ------------------- googletest/test/googletest-port-test.cc | 18 ---------------- 3 files changed, 3 insertions(+), 42 deletions(-) diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h index d7c9dd8c..c2e6eae3 100644 --- a/googletest/include/gtest/gtest-param-test.h +++ b/googletest/include/gtest/gtest-param-test.h @@ -174,6 +174,7 @@ TEST_P(DerivedTest, DoesBlah) { #endif // 0 +#include #include #include "gtest/internal/gtest-internal.h" @@ -292,10 +293,9 @@ internal::ParamGenerator Range(T start, T end) { // template internal::ParamGenerator< - typename ::testing::internal::IteratorTraits::value_type> + typename std::iterator_traits::value_type> ValuesIn(ForwardIterator begin, ForwardIterator end) { - typedef typename ::testing::internal::IteratorTraits - ::value_type ParamType; + typedef typename std::iterator_traits::value_type ParamType; return internal::ParamGenerator( new internal::ValuesInIteratorRangeGenerator(begin, end)); } diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 4f887c5e..8296a857 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -202,11 +202,6 @@ // Mutex, MutexLock, ThreadLocal, GetThreadCount() // - synchronization primitives. // -// Template meta programming: -// IteratorTraits - partial implementation of std::iterator_traits, which -// is not available in libCstd when compiled with Sun C++. -// -// // Regular expressions: // RE - a simple regular expression class using the POSIX // Extended Regular Expression syntax on UNIX-like platforms @@ -1937,22 +1932,6 @@ struct is_same : public false_type {}; template struct is_same : public true_type {}; -template -struct IteratorTraits { - typedef typename Iterator::value_type value_type; -}; - - -template -struct IteratorTraits { - typedef T value_type; -}; - -template -struct IteratorTraits { - typedef T value_type; -}; - #if GTEST_OS_WINDOWS # define GTEST_PATH_SEP_ "\\" # define GTEST_HAS_ALT_PATH_SEP_ 1 diff --git a/googletest/test/googletest-port-test.cc b/googletest/test/googletest-port-test.cc index 42035cc9..60d637c3 100644 --- a/googletest/test/googletest-port-test.cc +++ b/googletest/test/googletest-port-test.cc @@ -201,24 +201,6 @@ TEST(ImplicitCastTest, CanUseImplicitConstructor) { EXPECT_TRUE(converted); } -TEST(IteratorTraitsTest, WorksForSTLContainerIterators) { - StaticAssertTypeEq::const_iterator>::value_type>(); - StaticAssertTypeEq::iterator>::value_type>(); -} - -TEST(IteratorTraitsTest, WorksForPointerToNonConst) { - StaticAssertTypeEq::value_type>(); - StaticAssertTypeEq::value_type>(); -} - -TEST(IteratorTraitsTest, WorksForPointerToConst) { - StaticAssertTypeEq::value_type>(); - StaticAssertTypeEq::value_type>(); -} - TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) { if (AlwaysFalse()) GTEST_CHECK_(false) << "This should never be executed; "