Skip to content

Commit

Permalink
Merge pull request #2398 from kuzkry:custom-type-traits-iterator_traits
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 266136896
  • Loading branch information
gennadiycivil committed Aug 29, 2019
2 parents a648da9 + e2c06aa commit 565f1b8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 42 deletions.
6 changes: 3 additions & 3 deletions googletest/include/gtest/gtest-param-test.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ TEST_P(DerivedTest, DoesBlah) {

#endif // 0

#include <iterator>
#include <utility>

#include "gtest/internal/gtest-internal.h"
Expand Down Expand Up @@ -292,10 +293,9 @@ internal::ParamGenerator<T> Range(T start, T end) {
//
template <typename ForwardIterator>
internal::ParamGenerator<
typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type>
typename std::iterator_traits<ForwardIterator>::value_type>
ValuesIn(ForwardIterator begin, ForwardIterator end) {
typedef typename ::testing::internal::IteratorTraits<ForwardIterator>
::value_type ParamType;
typedef typename std::iterator_traits<ForwardIterator>::value_type ParamType;
return internal::ParamGenerator<ParamType>(
new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end));
}
Expand Down
21 changes: 0 additions & 21 deletions googletest/include/gtest/internal/gtest-port.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1901,22 +1896,6 @@ GTEST_API_ size_t GetThreadCount();
template <bool B>
using bool_constant = std::integral_constant<bool, B>;

template <typename Iterator>
struct IteratorTraits {
typedef typename Iterator::value_type value_type;
};


template <typename T>
struct IteratorTraits<T*> {
typedef T value_type;
};

template <typename T>
struct IteratorTraits<const T*> {
typedef T value_type;
};

#if GTEST_OS_WINDOWS
# define GTEST_PATH_SEP_ "\\"
# define GTEST_HAS_ALT_PATH_SEP_ 1
Expand Down
18 changes: 0 additions & 18 deletions googletest/test/googletest-port-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,24 +201,6 @@ TEST(ImplicitCastTest, CanUseImplicitConstructor) {
EXPECT_TRUE(converted);
}

TEST(IteratorTraitsTest, WorksForSTLContainerIterators) {
StaticAssertTypeEq<int,
IteratorTraits< ::std::vector<int>::const_iterator>::value_type>();
StaticAssertTypeEq<bool,
IteratorTraits< ::std::list<bool>::iterator>::value_type>();
}

TEST(IteratorTraitsTest, WorksForPointerToNonConst) {
StaticAssertTypeEq<char, IteratorTraits<char*>::value_type>();
StaticAssertTypeEq<const void*, IteratorTraits<const void**>::value_type>();
}

TEST(IteratorTraitsTest, WorksForPointerToConst) {
StaticAssertTypeEq<char, IteratorTraits<const char*>::value_type>();
StaticAssertTypeEq<const void*,
IteratorTraits<const void* const*>::value_type>();
}

TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) {
if (AlwaysFalse())
GTEST_CHECK_(false) << "This should never be executed; "
Expand Down

0 comments on commit 565f1b8

Please sign in to comment.