aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyohei Machida <machida_mn@complex.ist.hokudai.ac.jp>2018-12-27 11:33:30 -0500
committerGennadiy Civil <misterg@google.com>2018-12-27 15:31:14 -0500
commit6729a1361150131bc5d394d5cd2b4cdf0953ee7b (patch)
treebee3d2ae69fd5406d480adbcd827804b87fdf2b3
parent77004096e8507c945b865236a3828f25d314c657 (diff)
downloadgoogletest-6729a1361150131bc5d394d5cd2b4cdf0953ee7b.tar.gz
googletest-6729a1361150131bc5d394d5cd2b4cdf0953ee7b.tar.bz2
googletest-6729a1361150131bc5d394d5cd2b4cdf0953ee7b.zip
Merge #2002
PiperOrigin-RevId: 227030722
-rw-r--r--googletest/include/gtest/internal/gtest-internal.h31
-rw-r--r--googletest/test/googletest-printers-test.cc6
2 files changed, 15 insertions, 22 deletions
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index b32237a1..f66a5c1b 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -967,37 +967,24 @@ struct IsHashTable {
template <typename T>
const bool IsHashTable<T>::value;
-template<typename T>
-struct VoidT {
- typedef void value_type;
-};
-
-template <typename T, typename = void>
-struct HasValueType : false_type {};
-template <typename T>
-struct HasValueType<T, VoidT<typename T::value_type> > : true_type {
-};
-
template <typename C,
- bool = sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer),
- bool = HasValueType<C>::value>
+ bool = sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer)>
struct IsRecursiveContainerImpl;
-template <typename C, bool HV>
-struct IsRecursiveContainerImpl<C, false, HV> : public false_type {};
+template <typename C>
+struct IsRecursiveContainerImpl<C, false> : public false_type {};
// Since the IsRecursiveContainerImpl depends on the IsContainerTest we need to
// obey the same inconsistencies as the IsContainerTest, namely check if
// something is a container is relying on only const_iterator in C++11 and
// is relying on both const_iterator and iterator otherwise
template <typename C>
-struct IsRecursiveContainerImpl<C, true, false> : public false_type {};
-
-template <typename C>
-struct IsRecursiveContainerImpl<C, true, true> {
- typedef typename IteratorTraits<typename C::const_iterator>::value_type
- value_type;
- typedef is_same<value_type, C> type;
+struct IsRecursiveContainerImpl<C, true> {
+ using value_type = decltype(*std::declval<typename C::const_iterator>());
+ using type =
+ is_same<typename std::remove_const<
+ typename std::remove_reference<value_type>::type>::type,
+ C>;
};
// IsRecursiveContainer<Type> is a unary compile-time predicate that
diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc
index 139b3e49..961e8184 100644
--- a/googletest/test/googletest-printers-test.cc
+++ b/googletest/test/googletest-printers-test.cc
@@ -183,8 +183,14 @@ class PathLike {
public:
struct iterator {
typedef PathLike value_type;
+
+ iterator& operator++();
+ PathLike& operator*();
};
+ using value_type = char;
+ using const_iterator = iterator;
+
PathLike() {}
iterator begin() const { return iterator(); }