aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-04-12 20:36:11 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-04-12 20:36:11 +0000
commitb8c0e16eeb7496f71480c6a060144b0e050edcf5 (patch)
tree57f41578c3c5a7ccfb22591a9ec4f3fc2c697b85 /src
parentfc99b1ad515ccfc92ee92001c409f69385033af5 (diff)
downloadgoogletest-b8c0e16eeb7496f71480c6a060144b0e050edcf5.tar.gz
googletest-b8c0e16eeb7496f71480c6a060144b0e050edcf5.tar.bz2
googletest-b8c0e16eeb7496f71480c6a060144b0e050edcf5.zip
Fixes Sun C++ compiler errors (by Pasi Valminen)
Diffstat (limited to 'src')
-rw-r--r--src/gtest-internal-inl.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h
index e45f452a..65a2101a 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.