Function match

Synopsis

#include <include/internal/catch_matchers_vector.h>

bool match(std::vector< T, AllocMatch > const &v) const override

Description

No description yet.

Source

Lines 76-87 in include/internal/catch_matchers_vector.h.

bool match(std::vector<T, AllocMatch> const &v) const override {
    // !TBD: This currently works if all elements can be compared using !=
    // - a more general approach would be via a compare template that defaults
    // to using !=. but could be specialised for, e.g. std::vector<T, Alloc> etc
    // - then just call that directly
    if (m_comparator.size() != v.size())
        return false;
    for (std::size_t i = 0; i < v.size(); ++i)
        if (m_comparator[i] != v[i])
            return false;
    return true;
}





Add Discussion as Guest

Log in