@@ -92,58 +92,35 @@ namespace Catch {
92
92
}
93
93
};
94
94
95
- /* *
96
- * Creates a matcher that checks if all elements in a range are equal
97
- * to all elements in another range.
98
- *
99
- * Uses `std::equal_to` to do the comparison
100
- */
101
- template <typename RangeLike>
102
- constexpr
103
- std::enable_if_t <!Detail::is_matcher<RangeLike>::value,
104
- RangeEqualsMatcher<RangeLike, std::equal_to<>>>
105
- RangeEquals ( RangeLike&& range ) {
106
- return { CATCH_FORWARD ( range ), std::equal_to<>{} };
107
- }
108
-
109
95
/* *
110
96
* Creates a matcher that checks if all elements in a range are equal
111
97
* to all elements in another range.
112
98
*
113
99
* Uses the provided predicate `predicate` to do the comparisons
100
+ * (defaulting to `std::equal_to`)
114
101
*/
115
- template <typename RangeLike, typename Equality>
102
+ template <typename RangeLike,
103
+ typename Equality = decltype( std::equal_to<>{} )>
116
104
constexpr
117
105
RangeEqualsMatcher<RangeLike, Equality>
118
- RangeEquals ( RangeLike&& range, Equality&& predicate ) {
106
+ RangeEquals ( RangeLike&& range,
107
+ Equality&& predicate = std::equal_to<>{} ) {
119
108
return { CATCH_FORWARD ( range ), CATCH_FORWARD ( predicate ) };
120
109
}
121
110
122
- /* *
123
- * Creates a matcher that checks if all elements in a range are equal
124
- * to all elements in another range, in some permutation
125
- *
126
- * Uses `std::equal_to` to do the comparison
127
- */
128
- template <typename RangeLike>
129
- constexpr
130
- std::enable_if_t <
131
- !Detail::is_matcher<RangeLike>::value,
132
- UnorderedRangeEqualsMatcher<RangeLike, std::equal_to<>>>
133
- UnorderedRangeEquals ( RangeLike&& range ) {
134
- return { CATCH_FORWARD ( range ), std::equal_to<>{} };
135
- }
136
-
137
111
/* *
138
112
* Creates a matcher that checks if all elements in a range are equal
139
113
* to all elements in another range, in some permutation.
140
114
*
141
115
* Uses the provided predicate `predicate` to do the comparisons
116
+ * (defaulting to `std::equal_to`)
142
117
*/
143
- template <typename RangeLike, typename Equality>
118
+ template <typename RangeLike,
119
+ typename Equality = decltype( std::equal_to<>{} )>
144
120
constexpr
145
121
UnorderedRangeEqualsMatcher<RangeLike, Equality>
146
- UnorderedRangeEquals ( RangeLike&& range, Equality&& predicate ) {
122
+ UnorderedRangeEquals ( RangeLike&& range,
123
+ Equality&& predicate = std::equal_to<>{} ) {
147
124
return { CATCH_FORWARD ( range ), CATCH_FORWARD ( predicate ) };
148
125
}
149
126
} // namespace Matchers
0 commit comments