Makes WhenSorted() support associative containers (by billydonahue@google.com).

This commit is contained in:
zhanyong.wan
2013-03-27 16:14:55 +00:00
parent 1f122a06e6
commit a9a59e06dd
3 changed files with 179 additions and 1 deletions

View File

@@ -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) {}