aboutsummaryrefslogtreecommitdiffstats
path: root/include/gmock/gmock-matchers.h
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2013-03-27 16:14:55 +0000
committerzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2013-03-27 16:14:55 +0000
commita9a59e06dd7cdfe52c988bf065bc156a7ed96a5c (patch)
tree83accf8a936e23d9a639303d299d33b69da59d8c /include/gmock/gmock-matchers.h
parent1f122a06e6aad4d234123d2d8c1e352029ce0742 (diff)
downloadgoogletest-a9a59e06dd7cdfe52c988bf065bc156a7ed96a5c.tar.gz
googletest-a9a59e06dd7cdfe52c988bf065bc156a7ed96a5c.tar.bz2
googletest-a9a59e06dd7cdfe52c988bf065bc156a7ed96a5c.zip
Makes WhenSorted() support associative containers (by billydonahue@google.com).
Diffstat (limited to 'include/gmock/gmock-matchers.h')
-rw-r--r--include/gmock/gmock-matchers.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/gmock/gmock-matchers.h b/include/gmock/gmock-matchers.h
index ceb73fdd..962cfde9 100644
--- a/include/gmock/gmock-matchers.h
+++ b/include/gmock/gmock-matchers.h
@@ -2189,7 +2189,10 @@ class WhenSortedByMatcher {
GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView;
typedef typename LhsView::type LhsStlContainer;
typedef typename LhsView::const_reference LhsStlContainerReference;
- typedef typename LhsStlContainer::value_type LhsValue;
+ // Transforms std::pair<const Key, Value> into std::pair<Key, Value>
+ // so that we can match associative containers.
+ typedef typename RemoveConstFromKey<
+ typename LhsStlContainer::value_type>::type LhsValue;
Impl(const Comparator& comparator, const ContainerMatcher& matcher)
: comparator_(comparator), matcher_(matcher) {}