diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-04-12 18:24:59 (GMT) |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-04-12 18:24:59 (GMT) |
commit | fc99b1ad515ccfc92ee92001c409f69385033af5 (patch) | |
tree | c8732acb1a441408870c5e816a3afd01ae1f2e62 /include/gtest | |
parent | e9adbcbb56a205dee270842f7d6221c52d508476 (diff) | |
download | googletest-fc99b1ad515ccfc92ee92001c409f69385033af5.zip googletest-fc99b1ad515ccfc92ee92001c409f69385033af5.tar.gz googletest-fc99b1ad515ccfc92ee92001c409f69385033af5.tar.bz2 |
Avoids iterator_traits, as it's not available in libCStd when compiled with Sun C++.
Diffstat (limited to 'include/gtest')
-rw-r--r-- | include/gtest/gtest-param-test.h | 9 | ||||
-rw-r--r-- | include/gtest/gtest-param-test.h.pump | 9 | ||||
-rw-r--r-- | include/gtest/internal/gtest-param-util-generated.h | 8 | ||||
-rw-r--r-- | include/gtest/internal/gtest-param-util-generated.h.pump | 4 | ||||
-rw-r--r-- | include/gtest/internal/gtest-port.h | 17 |
5 files changed, 32 insertions, 15 deletions
diff --git a/include/gtest/gtest-param-test.h b/include/gtest/gtest-param-test.h index 62c7c00..6407cfd 100644 --- a/include/gtest/gtest-param-test.h +++ b/include/gtest/gtest-param-test.h @@ -306,11 +306,10 @@ internal::ParamGenerator<T> Range(T start, T end) { // template <typename ForwardIterator> internal::ParamGenerator< - typename ::std::iterator_traits<ForwardIterator>::value_type> ValuesIn( - ForwardIterator begin, - ForwardIterator end) { - typedef typename ::std::iterator_traits<ForwardIterator>::value_type - ParamType; + typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type> +ValuesIn(ForwardIterator begin, ForwardIterator end) { + typedef typename ::testing::internal::IteratorTraits<ForwardIterator> + ::value_type ParamType; return internal::ParamGenerator<ParamType>( new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end)); } diff --git a/include/gtest/gtest-param-test.h.pump b/include/gtest/gtest-param-test.h.pump index 877126b..401cb51 100644 --- a/include/gtest/gtest-param-test.h.pump +++ b/include/gtest/gtest-param-test.h.pump @@ -305,11 +305,10 @@ internal::ParamGenerator<T> Range(T start, T end) { // template <typename ForwardIterator> internal::ParamGenerator< - typename ::std::iterator_traits<ForwardIterator>::value_type> ValuesIn( - ForwardIterator begin, - ForwardIterator end) { - typedef typename ::std::iterator_traits<ForwardIterator>::value_type - ParamType; + typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type> +ValuesIn(ForwardIterator begin, ForwardIterator end) { + typedef typename ::testing::internal::IteratorTraits<ForwardIterator> + ::value_type ParamType; return internal::ParamGenerator<ParamType>( new internal::ValuesInIteratorRangeGenerator<ParamType>(begin, end)); } diff --git a/include/gtest/internal/gtest-param-util-generated.h b/include/gtest/internal/gtest-param-util-generated.h index c6f0ce0..2582675 100644 --- a/include/gtest/internal/gtest-param-util-generated.h +++ b/include/gtest/internal/gtest-param-util-generated.h @@ -1,4 +1,6 @@ -// This file was GENERATED by a script. DO NOT EDIT BY HAND!!! +// This file was GENERATED by command: +// pump.py gtest-param-util-generated.h.pump +// DO NOT EDIT BY HAND!!! // Copyright 2008 Google Inc. // All Rights Reserved. @@ -58,8 +60,8 @@ namespace testing { // include/gtest/gtest-param-test.h. template <typename ForwardIterator> internal::ParamGenerator< - typename ::std::iterator_traits<ForwardIterator>::value_type> ValuesIn( - ForwardIterator begin, ForwardIterator end); + typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type> +ValuesIn(ForwardIterator begin, ForwardIterator end); template <typename T, size_t N> internal::ParamGenerator<T> ValuesIn(const T (&array)[N]); diff --git a/include/gtest/internal/gtest-param-util-generated.h.pump b/include/gtest/internal/gtest-param-util-generated.h.pump index c148bb1..dbe9386 100644 --- a/include/gtest/internal/gtest-param-util-generated.h.pump +++ b/include/gtest/internal/gtest-param-util-generated.h.pump @@ -59,8 +59,8 @@ namespace testing { // include/gtest/gtest-param-test.h. template <typename ForwardIterator> internal::ParamGenerator< - typename ::std::iterator_traits<ForwardIterator>::value_type> ValuesIn( - ForwardIterator begin, ForwardIterator end); + typename ::testing::internal::IteratorTraits<ForwardIterator>::value_type> +ValuesIn(ForwardIterator begin, ForwardIterator end); template <typename T, size_t N> internal::ParamGenerator<T> ValuesIn(const T (&array)[N]); diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h index 53cf824..d2bc6cb 100644 --- a/include/gtest/internal/gtest-port.h +++ b/include/gtest/internal/gtest-port.h @@ -140,6 +140,8 @@ // // Template meta programming: // is_pointer - as in TR1; needed on Symbian and IBM XL C/C++ only. +// IteratorTraits - partial implementation of std::iterator_traits, which +// is not available in libCstd when compiled with Sun C++. // // Smart pointers: // scoped_ptr - as in TR2. @@ -1466,6 +1468,21 @@ struct is_pointer : public false_type {}; template <typename T> struct is_pointer<T*> : public true_type {}; +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 |