[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.
Chandler Carruth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 10 16:20:04 PST 2017
chandlerc added inline comments.
================
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<
----------------
dblaikie wrote:
> 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?)
Well, this is the only place where we're computing difference_type, so I'll leave it as a trait for now.
If you'd like to change though, happy to do that in a follow-up.
https://reviews.llvm.org/D28288
More information about the llvm-commits
mailing list