-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRTP matchers #1554
CRTP matchers #1554
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1554 +/- ##
=========================================
- Coverage 80.54% 80.33% -0.2%
=========================================
Files 121 118 -3
Lines 3386 3361 -25
=========================================
- Hits 2727 2700 -27
- Misses 659 661 +2 |
Codecov Report
@@ Coverage Diff @@
## dev-v3 #1554 +/- ##
==========================================
+ Coverage 89.28% 94.29% +5.01%
==========================================
Files 139 8 -131
Lines 5997 70 -5927
==========================================
- Hits 5354 66 -5288
+ Misses 643 4 -639 |
8575039
to
9c83cf5
Compare
9ed5849
to
e2f2134
Compare
e2f2134
to
6cf1e3d
Compare
I've renamed the new generic matcher to |
In my PR I found I could get away without CRTP, just having a base class from the namespace where the non-member operator overloads are defined is enough to get them picked up via ADL. (With a non-CRTP |
This commit extends the Matchers feature with the ability to have type-independent (e.g. templated) matchers. This is done by adding a new base type that Matchers can extend, `MatcherGenericBase`, and overloads of operators `!`, `&&` and `||` that handle matchers extending `MatcherGenericBase` in a special manner. These new matchers can also take their arguments as values and non-const references. Closes #1307 Closes #1553 Closes #1554 Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
Description
As discussed in #1553, the current matchers implementation forces passing values by const ref. Changing the implementation to be CRTP based instead of dynamic polymorphism, enables forwarding the checked value as it is.
A nice benefit is that it is no longer required to explicitly set the value type for the
Predicate
matcher.GitHub Issues
#1553