File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -900,15 +900,16 @@ using ::testing::Not;
900900
901901Matchers are function objects, and parametrized matchers can be composed just
902902like any other function. However because their types can be long and rarely
903- provide meaningful information, it can be easier to express them with C++14
904- generic lambdas to avoid specifying types . For example,
903+ provide meaningful information, it can be easier to express them with template
904+ parameters and `auto` . For example,
905905
906906```cpp
907907using ::testing::Contains;
908908using ::testing::Property;
909909
910- inline constexpr auto HasFoo = [](const auto& f) {
911- return Property("foo", &MyClass::foo, Contains(f));
910+ template <typename SubMatcher>
911+ inline constexpr auto HasFoo(const SubMatcher& sub_matcher) {
912+ return Property("foo", &MyClass::foo, Contains(sub_matcher));
912913};
913914...
914915 EXPECT_THAT(x, HasFoo("blah"));
You can’t perform that action at this time.
0 commit comments