Skip to content

Commit e4717df

Browse files
committed
Merge pull request #3195 from Inujel:fix-3194
PiperOrigin-RevId: 398271948
2 parents 09074c1 + 9614d8c commit e4717df

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

googlemock/include/gmock/gmock-matchers.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,7 +2425,6 @@ class ContainerEqMatcher {
24252425
typedef internal::StlContainerView<
24262426
typename std::remove_const<LhsContainer>::type>
24272427
LhsView;
2428-
typedef typename LhsView::type LhsStlContainer;
24292428
StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
24302429
if (lhs_stl_container == expected_)
24312430
return true;
@@ -2434,8 +2433,7 @@ class ContainerEqMatcher {
24342433
if (os != nullptr) {
24352434
// Something is different. Check for extra values first.
24362435
bool printed_header = false;
2437-
for (typename LhsStlContainer::const_iterator it =
2438-
lhs_stl_container.begin();
2436+
for (auto it = lhs_stl_container.begin();
24392437
it != lhs_stl_container.end(); ++it) {
24402438
if (internal::ArrayAwareFind(expected_.begin(), expected_.end(), *it) ==
24412439
expected_.end()) {
@@ -2451,7 +2449,7 @@ class ContainerEqMatcher {
24512449

24522450
// Now check for missing values.
24532451
bool printed_header2 = false;
2454-
for (typename StlContainer::const_iterator it = expected_.begin();
2452+
for (auto it = expected_.begin();
24552453
it != expected_.end(); ++it) {
24562454
if (internal::ArrayAwareFind(
24572455
lhs_stl_container.begin(), lhs_stl_container.end(), *it) ==
@@ -2635,8 +2633,8 @@ class PointwiseMatcher {
26352633
return false;
26362634
}
26372635

2638-
typename LhsStlContainer::const_iterator left = lhs_stl_container.begin();
2639-
typename RhsStlContainer::const_iterator right = rhs_.begin();
2636+
auto left = lhs_stl_container.begin();
2637+
auto right = rhs_.begin();
26402638
for (size_t i = 0; i != actual_size; ++i, ++left, ++right) {
26412639
if (listener->IsInterested()) {
26422640
StringMatchResultListener inner_listener;
@@ -2699,7 +2697,7 @@ class QuantifierMatcherImpl : public MatcherInterface<Container> {
26992697
MatchResultListener* listener) const {
27002698
StlContainerReference stl_container = View::ConstReference(container);
27012699
size_t i = 0;
2702-
for (typename StlContainer::const_iterator it = stl_container.begin();
2700+
for (auto it = stl_container.begin();
27032701
it != stl_container.end(); ++it, ++i) {
27042702
StringMatchResultListener inner_listener;
27052703
const bool matches = inner_matcher_.MatchAndExplain(*it, &inner_listener);
@@ -3400,7 +3398,7 @@ class ElementsAreMatcherImpl : public MatcherInterface<Container> {
34003398
// explanations[i] is the explanation of the element at index i.
34013399
::std::vector<std::string> explanations(count());
34023400
StlContainerReference stl_container = View::ConstReference(container);
3403-
typename StlContainer::const_iterator it = stl_container.begin();
3401+
auto it = stl_container.begin();
34043402
size_t exam_pos = 0;
34053403
bool mismatch_found = false; // Have we found a mismatched element yet?
34063404

@@ -3593,7 +3591,6 @@ class UnorderedElementsAreMatcherImpl
35933591
typedef internal::StlContainerView<RawContainer> View;
35943592
typedef typename View::type StlContainer;
35953593
typedef typename View::const_reference StlContainerReference;
3596-
typedef typename StlContainer::const_iterator StlContainerConstIterator;
35973594
typedef typename StlContainer::value_type Element;
35983595

35993596
template <typename InputIter>
@@ -4760,7 +4757,7 @@ UnorderedPointwise(const Tuple2Matcher& tuple2_matcher,
47604757

47614758
// Create a matcher for each element in rhs_container.
47624759
::std::vector<internal::BoundSecondMatcher<Tuple2Matcher, Second> > matchers;
4763-
for (typename RhsStlContainer::const_iterator it = rhs_stl_container.begin();
4760+
for (auto it = rhs_stl_container.begin();
47644761
it != rhs_stl_container.end(); ++it) {
47654762
matchers.push_back(
47664763
internal::MatcherBindSecond(tuple2_matcher, *it));

googletest/src/gtest-internal-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ inline int CountIf(const Container& c, Predicate predicate) {
273273
// Implemented as an explicit loop since std::count_if() in libCstd on
274274
// Solaris has a non-standard signature.
275275
int count = 0;
276-
for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) {
276+
for (auto it = c.begin(); it != c.end(); ++it) {
277277
if (predicate(*it))
278278
++count;
279279
}

0 commit comments

Comments
 (0)