diff options
author | Gennadiy Civil <misterg@google.com> | 2018-03-16 19:56:31 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2018-03-16 19:56:31 (GMT) |
commit | a3c2e107aeb7e821b76164cea366094ce420b656 (patch) | |
tree | 06bf0481d2b505b2adb4aaa0ccf246fded7d5af3 /googletest/include/gtest/internal/gtest-internal.h | |
parent | 080fcbe0aae28dec00c2903ea04f2d2b022deb12 (diff) | |
download | googletest-a3c2e107aeb7e821b76164cea366094ce420b656.zip googletest-a3c2e107aeb7e821b76164cea366094ce420b656.tar.gz googletest-a3c2e107aeb7e821b76164cea366094ce420b656.tar.bz2 |
cl 189032107, againrefs/pull/1508/head
Diffstat (limited to 'googletest/include/gtest/internal/gtest-internal.h')
-rw-r--r-- | googletest/include/gtest/internal/gtest-internal.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 6e904a8..ffc22f9 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -933,19 +933,34 @@ 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 = sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer), + bool = HasValueType<C>::value> struct IsRecursiveContainerImpl; -template <typename C> -struct IsRecursiveContainerImpl<C, false> : public false_type {}; +template <typename C, bool HV> +struct IsRecursiveContainerImpl<C, false, HV> : 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> { +struct IsRecursiveContainerImpl<C, true, false> : public false_type {}; + +template <typename C> +struct IsRecursiveContainerImpl<C, true, true> { #if GTEST_LANG_CXX11 typedef typename IteratorTraits<typename C::const_iterator>::value_type value_type; |