From b8c0e16eeb7496f71480c6a060144b0e050edcf5 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Tue, 12 Apr 2011 20:36:11 +0000 Subject: Fixes Sun C++ compiler errors (by Pasi Valminen) --- src/gtest-internal-inl.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') 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 inline int CountIf(const Container& c, Predicate predicate) { - return static_cast(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. -- cgit v1.2.3