-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Provide overloads for {Unordered}RangeEquals taking a std::initializer_list #2919
Provide overloads for {Unordered}RangeEquals taking a std::initializer_list #2919
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## devel #2919 +/- ##
=======================================
Coverage 90.99% 90.99%
=======================================
Files 198 198
Lines 8597 8597
=======================================
Hits 7822 7822
Misses 775 775 |
template <typename T> | ||
constexpr | ||
UnorderedRangeEqualsMatcher<std::initializer_list<T>, std::equal_to<>> | ||
UnorderedRangeEquals( std::initializer_list<T> range ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that this copies the old overloads, but I wonder why I went with overloads instead of defaulted comparison parameter back then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered the same, but was reluctant to change it. Now that you mention it, I added a commit (before mine) to clean this up: 5328f90. Sorry for force-pushing, but I didn't want to put a commit on top that changes it both for the existing code and the new overloads; the diffs are much cleaner this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to look into the overload vs default argument a bit later, but the PR looks good.
…ed}RangeEquals Saves some code duplication.
…r_list This allows writing something like const auto v = calculateSomeVectorOfInts(); CHECK_THAT(v, RangeEquals({1, 2, 3})); Fixes catchorg#2915.
1c6a187
to
ef2f8fb
Compare
The default args should be fine here. The usual arguments against should not apply to this use case. Thanks for the change. |
This allows writing something like
Fixes #2915.