Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
9614d8c1
Commit
9614d8c1
authored
Dec 29, 2020
by
Julien JEMINE
Browse files
Using auto instead of container::const_iterator
parent
389cb68b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
11 deletions
+8
-11
googlemock/include/gmock/gmock-matchers.h
googlemock/include/gmock/gmock-matchers.h
+7
-10
googletest/src/gtest-internal-inl.h
googletest/src/gtest-internal-inl.h
+1
-1
No files found.
googlemock/include/gmock/gmock-matchers.h
View file @
9614d8c1
...
@@ -2370,7 +2370,6 @@ class ContainerEqMatcher {
...
@@ -2370,7 +2370,6 @@ class ContainerEqMatcher {
typedef
internal
::
StlContainerView
<
typedef
internal
::
StlContainerView
<
typename
std
::
remove_const
<
LhsContainer
>::
type
>
typename
std
::
remove_const
<
LhsContainer
>::
type
>
LhsView
;
LhsView
;
typedef
typename
LhsView
::
type
LhsStlContainer
;
StlContainerReference
lhs_stl_container
=
LhsView
::
ConstReference
(
lhs
);
StlContainerReference
lhs_stl_container
=
LhsView
::
ConstReference
(
lhs
);
if
(
lhs_stl_container
==
expected_
)
if
(
lhs_stl_container
==
expected_
)
return
true
;
return
true
;
...
@@ -2379,8 +2378,7 @@ class ContainerEqMatcher {
...
@@ -2379,8 +2378,7 @@ class ContainerEqMatcher {
if
(
os
!=
nullptr
)
{
if
(
os
!=
nullptr
)
{
// Something is different. Check for extra values first.
// Something is different. Check for extra values first.
bool
printed_header
=
false
;
bool
printed_header
=
false
;
for
(
typename
LhsStlContainer
::
const_iterator
it
=
for
(
auto
it
=
lhs_stl_container
.
begin
();
lhs_stl_container
.
begin
();
it
!=
lhs_stl_container
.
end
();
++
it
)
{
it
!=
lhs_stl_container
.
end
();
++
it
)
{
if
(
internal
::
ArrayAwareFind
(
expected_
.
begin
(),
expected_
.
end
(),
*
it
)
==
if
(
internal
::
ArrayAwareFind
(
expected_
.
begin
(),
expected_
.
end
(),
*
it
)
==
expected_
.
end
())
{
expected_
.
end
())
{
...
@@ -2396,7 +2394,7 @@ class ContainerEqMatcher {
...
@@ -2396,7 +2394,7 @@ class ContainerEqMatcher {
// Now check for missing values.
// Now check for missing values.
bool
printed_header2
=
false
;
bool
printed_header2
=
false
;
for
(
typename
StlContainer
::
const_iterator
it
=
expected_
.
begin
();
for
(
auto
it
=
expected_
.
begin
();
it
!=
expected_
.
end
();
++
it
)
{
it
!=
expected_
.
end
();
++
it
)
{
if
(
internal
::
ArrayAwareFind
(
if
(
internal
::
ArrayAwareFind
(
lhs_stl_container
.
begin
(),
lhs_stl_container
.
end
(),
*
it
)
==
lhs_stl_container
.
begin
(),
lhs_stl_container
.
end
(),
*
it
)
==
...
@@ -2580,8 +2578,8 @@ class PointwiseMatcher {
...
@@ -2580,8 +2578,8 @@ class PointwiseMatcher {
return
false
;
return
false
;
}
}
typename
LhsStlContainer
::
const_iter
ato
r
left
=
lhs_stl_container
.
begin
();
a
u
to
left
=
lhs_stl_container
.
begin
();
typename
RhsStlContainer
::
const_iter
ato
r
right
=
rhs_
.
begin
();
a
u
to
right
=
rhs_
.
begin
();
for
(
size_t
i
=
0
;
i
!=
actual_size
;
++
i
,
++
left
,
++
right
)
{
for
(
size_t
i
=
0
;
i
!=
actual_size
;
++
i
,
++
left
,
++
right
)
{
if
(
listener
->
IsInterested
())
{
if
(
listener
->
IsInterested
())
{
StringMatchResultListener
inner_listener
;
StringMatchResultListener
inner_listener
;
...
@@ -2644,7 +2642,7 @@ class QuantifierMatcherImpl : public MatcherInterface<Container> {
...
@@ -2644,7 +2642,7 @@ class QuantifierMatcherImpl : public MatcherInterface<Container> {
MatchResultListener
*
listener
)
const
{
MatchResultListener
*
listener
)
const
{
StlContainerReference
stl_container
=
View
::
ConstReference
(
container
);
StlContainerReference
stl_container
=
View
::
ConstReference
(
container
);
size_t
i
=
0
;
size_t
i
=
0
;
for
(
typename
StlContainer
::
const_iterator
it
=
stl_container
.
begin
();
for
(
auto
it
=
stl_container
.
begin
();
it
!=
stl_container
.
end
();
++
it
,
++
i
)
{
it
!=
stl_container
.
end
();
++
it
,
++
i
)
{
StringMatchResultListener
inner_listener
;
StringMatchResultListener
inner_listener
;
const
bool
matches
=
inner_matcher_
.
MatchAndExplain
(
*
it
,
&
inner_listener
);
const
bool
matches
=
inner_matcher_
.
MatchAndExplain
(
*
it
,
&
inner_listener
);
...
@@ -3241,7 +3239,7 @@ class ElementsAreMatcherImpl : public MatcherInterface<Container> {
...
@@ -3241,7 +3239,7 @@ class ElementsAreMatcherImpl : public MatcherInterface<Container> {
// explanations[i] is the explanation of the element at index i.
// explanations[i] is the explanation of the element at index i.
::
std
::
vector
<
std
::
string
>
explanations
(
count
());
::
std
::
vector
<
std
::
string
>
explanations
(
count
());
StlContainerReference
stl_container
=
View
::
ConstReference
(
container
);
StlContainerReference
stl_container
=
View
::
ConstReference
(
container
);
typename
StlContainer
::
const_iterator
it
=
stl_container
.
begin
();
auto
it
=
stl_container
.
begin
();
size_t
exam_pos
=
0
;
size_t
exam_pos
=
0
;
bool
mismatch_found
=
false
;
// Have we found a mismatched element yet?
bool
mismatch_found
=
false
;
// Have we found a mismatched element yet?
...
@@ -3434,7 +3432,6 @@ class UnorderedElementsAreMatcherImpl
...
@@ -3434,7 +3432,6 @@ class UnorderedElementsAreMatcherImpl
typedef
internal
::
StlContainerView
<
RawContainer
>
View
;
typedef
internal
::
StlContainerView
<
RawContainer
>
View
;
typedef
typename
View
::
type
StlContainer
;
typedef
typename
View
::
type
StlContainer
;
typedef
typename
View
::
const_reference
StlContainerReference
;
typedef
typename
View
::
const_reference
StlContainerReference
;
typedef
typename
StlContainer
::
const_iterator
StlContainerConstIterator
;
typedef
typename
StlContainer
::
value_type
Element
;
typedef
typename
StlContainer
::
value_type
Element
;
template
<
typename
InputIter
>
template
<
typename
InputIter
>
...
@@ -4597,7 +4594,7 @@ UnorderedPointwise(const Tuple2Matcher& tuple2_matcher,
...
@@ -4597,7 +4594,7 @@ UnorderedPointwise(const Tuple2Matcher& tuple2_matcher,
// Create a matcher for each element in rhs_container.
// Create a matcher for each element in rhs_container.
::
std
::
vector
<
internal
::
BoundSecondMatcher
<
Tuple2Matcher
,
Second
>
>
matchers
;
::
std
::
vector
<
internal
::
BoundSecondMatcher
<
Tuple2Matcher
,
Second
>
>
matchers
;
for
(
typename
RhsStlContainer
::
const_iter
ato
r
it
=
rhs_stl_container
.
begin
();
for
(
a
u
to
it
=
rhs_stl_container
.
begin
();
it
!=
rhs_stl_container
.
end
();
++
it
)
{
it
!=
rhs_stl_container
.
end
();
++
it
)
{
matchers
.
push_back
(
matchers
.
push_back
(
internal
::
MatcherBindSecond
(
tuple2_matcher
,
*
it
));
internal
::
MatcherBindSecond
(
tuple2_matcher
,
*
it
));
...
...
googletest/src/gtest-internal-inl.h
View file @
9614d8c1
...
@@ -290,7 +290,7 @@ inline int CountIf(const Container& c, Predicate predicate) {
...
@@ -290,7 +290,7 @@ inline int CountIf(const Container& c, Predicate predicate) {
// Implemented as an explicit loop since std::count_if() in libCstd on
// Implemented as an explicit loop since std::count_if() in libCstd on
// Solaris has a non-standard signature.
// Solaris has a non-standard signature.
int
count
=
0
;
int
count
=
0
;
for
(
typename
Container
::
const_iter
ato
r
it
=
c
.
begin
();
it
!=
c
.
end
();
++
it
)
{
for
(
a
u
to
it
=
c
.
begin
();
it
!=
c
.
end
();
++
it
)
{
if
(
predicate
(
*
it
))
if
(
predicate
(
*
it
))
++
count
;
++
count
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment