Cleanup visibility in generic not matcher

This commit is contained in:
Martin Hořeňovský 2020-02-19 20:23:02 +01:00
parent 25c5ae240c
commit d33af93e17
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -170,6 +170,11 @@ namespace Matchers {
return "not " + m_matcher.toString(); return "not " + m_matcher.toString();
} }
//! Negating negation can just unwrap and return underlying matcher
friend MatcherT const& operator ! (Detail::MatchNotOfGeneric<MatcherT> const& matcher) {
return matcher.m_matcher;
}
private:
MatcherT const& m_matcher; MatcherT const& m_matcher;
}; };
} // namespace Detail } // namespace Detail
@ -190,6 +195,7 @@ namespace Matchers {
return { lhs, rhs }; return { lhs, rhs };
} }
//! Wrap provided generic matcher in generic negator
template<typename MatcherT> template<typename MatcherT>
typename std::enable_if<Detail::is_generic_matcher<MatcherT>::value, Detail::MatchNotOfGeneric<MatcherT>>::type typename std::enable_if<Detail::is_generic_matcher<MatcherT>::value, Detail::MatchNotOfGeneric<MatcherT>>::type
operator ! (MatcherT const& matcher) { operator ! (MatcherT const& matcher) {
@ -260,12 +266,6 @@ namespace Matchers {
return Detail::MatchAnyOfGeneric<MatcherLHS, MatchersRHS...>{Detail::array_cat(static_cast<void const*>(std::addressof(lhs)), std::move(rhs.m_matchers))}; return Detail::MatchAnyOfGeneric<MatcherLHS, MatchersRHS...>{Detail::array_cat(static_cast<void const*>(std::addressof(lhs)), std::move(rhs.m_matchers))};
} }
template<typename MatcherT>
MatcherT const& operator ! (Detail::MatchNotOfGeneric<MatcherT> const& matcher) {
return matcher.m_matcher;
}
} // namespace Matchers } // namespace Matchers
} // namespace Catch } // namespace Catch