[PATCH] D28288: [gmock] (WIP) Teach gmock ElementsAre and BeginEndDistanceIs matchers to handle generic ranges by using std::begin and std::end rather than requiring things to look exactly like an STL container.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 12:42:28 PST 2017


dblaikie accepted this revision.
dblaikie added inline comments.
This revision is now accepted and ready to land.


================
Comment at: utils/unittest/googlemock/include/gmock/gmock-matchers.h:2465-2472
+    typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
+    typedef internal::StlContainerView<RawContainer> View;
+    typedef typename View::type StlContainer;
+    typedef typename View::const_reference StlContainerReference;
+    typedef decltype(std::begin(
+        std::declval<StlContainerReference>())) StlContainerConstIterator;
     typedef typename std::iterator_traits<
----------------
This one you use iterator_traits for - the others you use declval/decltype. What's the reason there?

(I guess it's closer to the original code?)


https://reviews.llvm.org/D28288





More information about the llvm-commits mailing list