Struct UnorderedEqualsMatcher
Synopsis
#include <include/internal/catch_matchers_vector.h>
template<typename T, typename AllocComp, typename AllocMatch>
struct UnorderedEqualsMatcher : MatcherBase<std::vector<T, AllocMatch>>
Description
No description yet.
Mentioned in
- Other / Release Notes / Fixes
Inheritance
Ancestors: MatcherBase
Methods
UnorderedEqualsMatcher | ||
describe | ||
match |
Source
Lines 130-145 in include/internal/catch_matchers_vector.h.
template<typename T, typename AllocComp, typename AllocMatch>
struct UnorderedEqualsMatcher : MatcherBase<std::vector<T, AllocMatch>> {
UnorderedEqualsMatcher(std::vector<T, AllocComp> const& target) : m_target(target) {}
bool match(std::vector<T, AllocMatch> const& vec) const override {
if (m_target.size() != vec.size()) {
return false;
}
return std::is_permutation(m_target.begin(), m_target.end(), vec.begin());
}
std::string describe() const override {
return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target);
}
private:
std::vector<T, AllocComp> const& m_target;
};