diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-04-12 20:36:11 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-04-12 20:36:11 +0000 |
commit | 96930a7040eb08bf41099e4cd096cb0e55deb14d (patch) | |
tree | 57f41578c3c5a7ccfb22591a9ec4f3fc2c697b85 /src/gtest-internal-inl.h | |
parent | 6624187c3141f7ca403056062c440582630cd909 (diff) | |
download | gtest-96930a7040eb08bf41099e4cd096cb0e55deb14d.tar.gz gtest-96930a7040eb08bf41099e4cd096cb0e55deb14d.tar.bz2 gtest-96930a7040eb08bf41099e4cd096cb0e55deb14d.tar.xz |
Fixes Sun C++ compiler errors (by Pasi Valminen)
git-svn-id: http://googletest.googlecode.com/svn/trunk@569 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'src/gtest-internal-inl.h')
-rw-r--r-- | src/gtest-internal-inl.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h index e45f452..65a2101 100644 --- a/src/gtest-internal-inl.h +++ b/src/gtest-internal-inl.h @@ -271,7 +271,14 @@ GTEST_API_ bool ShouldRunTestOnShard( // the given predicate. template <class Container, typename Predicate> inline int CountIf(const Container& c, Predicate predicate) { - return static_cast<int>(std::count_if(c.begin(), c.end(), predicate)); + // Implemented as an explicit loop since std::count_if() in libCstd on + // Solaris has a non-standard signature. + int count = 0; + for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) { + if (predicate(*it)) + ++count; + } + return count; } // Applies a function/functor to each element in the container. |