mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Use UDLs to construct StringRefs for decomposed operators directly
This commit is contained in:
parent
eef6c9b79b
commit
b93cf932fb
@ -178,47 +178,47 @@ namespace Catch {
|
|||||||
|
|
||||||
template<typename RhsT>
|
template<typename RhsT>
|
||||||
auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
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 {
|
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>
|
template<typename RhsT>
|
||||||
auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
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 {
|
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>
|
template<typename RhsT>
|
||||||
auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
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>
|
template<typename RhsT>
|
||||||
auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
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>
|
template<typename RhsT>
|
||||||
auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
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>
|
template<typename RhsT>
|
||||||
auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
|
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>
|
template <typename RhsT>
|
||||||
auto operator | (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
|
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>
|
template <typename RhsT>
|
||||||
auto operator & (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
|
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>
|
template <typename RhsT>
|
||||||
auto operator ^ (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
|
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>
|
template<typename RhsT>
|
||||||
|
Loading…
Reference in New Issue
Block a user