Use UDLs to construct StringRefs for decomposed operators directly

This commit is contained in:
Martin Hořeňovský 2020-05-09 21:07:42 +02:00
parent eef6c9b79b
commit b93cf932fb
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -178,47 +178,47 @@ namespace Catch {
template<typename RhsT>
auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs };
return { compareEqual( m_lhs, rhs ), m_lhs, "=="_sr, rhs };
}
auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
return { m_lhs == rhs, m_lhs, "==", rhs };
return { m_lhs == rhs, m_lhs, "=="_sr, rhs };
}
template<typename RhsT>
auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs };
return { compareNotEqual( m_lhs, rhs ), m_lhs, "!="_sr, rhs };
}
auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
return { m_lhs != rhs, m_lhs, "!=", rhs };
return { m_lhs != rhs, m_lhs, "!="_sr, rhs };
}
template<typename RhsT>
auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
return { static_cast<bool>(m_lhs > rhs), m_lhs, ">", rhs };
return { static_cast<bool>(m_lhs > rhs), m_lhs, ">"_sr, rhs };
}
template<typename RhsT>
auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
return { static_cast<bool>(m_lhs < rhs), m_lhs, "<", rhs };
return { static_cast<bool>(m_lhs < rhs), m_lhs, "<"_sr, rhs };
}
template<typename RhsT>
auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
return { static_cast<bool>(m_lhs >= rhs), m_lhs, ">=", rhs };
return { static_cast<bool>(m_lhs >= rhs), m_lhs, ">="_sr, rhs };
}
template<typename RhsT>
auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<=", rhs };
return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<="_sr, rhs };
}
template <typename RhsT>
auto operator | (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
return { static_cast<bool>(m_lhs | rhs), m_lhs, "|", rhs };
return { static_cast<bool>(m_lhs | rhs), m_lhs, "|"_sr, rhs };
}
template <typename RhsT>
auto operator & (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
return { static_cast<bool>(m_lhs & rhs), m_lhs, "&", rhs };
return { static_cast<bool>(m_lhs & rhs), m_lhs, "&"_sr, rhs };
}
template <typename RhsT>
auto operator ^ (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
return { static_cast<bool>(m_lhs ^ rhs), m_lhs, "^", rhs };
return { static_cast<bool>(m_lhs ^ rhs), m_lhs, "^"_sr, rhs };
}
template<typename RhsT>