diff options
Diffstat (limited to 'googletest/include/gtest/internal/gtest-internal.h')
-rw-r--r-- | googletest/include/gtest/internal/gtest-internal.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 72d83f0..2a6e4da 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -940,6 +940,31 @@ typedef char IsNotContainer; template <class C> IsNotContainer IsContainerTest(long /* dummy */) { return '\0'; } +template <typename C, bool = + sizeof(IsContainerTest<C>(0)) == sizeof(IsContainer) +> +struct IsRecursiveContainerImpl; + +template <typename C> +struct IsRecursiveContainerImpl<C, false> : public false_type {}; + +template <typename C> +struct IsRecursiveContainerImpl<C, true> { + typedef + typename IteratorTraits<typename C::iterator>::value_type + value_type; + typedef is_same<value_type, C> type; +}; + +// IsRecursiveContainer<Type> is a unary compile-time predicate that +// evaluates whether C is a recursive container type. A recursive container +// type is a container type whose value_type is equal to the container type +// itself. An example for a recursive container type is +// boost::filesystem::path, whose iterator has a value_type that is equal to +// boost::filesystem::path. +template<typename C> +struct IsRecursiveContainer : public IsRecursiveContainerImpl<C>::type {}; + // EnableIf<condition>::type is void when 'Cond' is true, and // undefined when 'Cond' is false. To use SFINAE to make a function // overload only apply when a particular expression is true, add |