Class ExprLhs

Synopsis

#include <include/internal/catch_decomposer.h>

template<typename LhsT>
class ExprLhs

Description

No description yet.

Methods

ExprLhs
makeUnaryExpr
operator!= overload
operator&
operator&&
operator<
operator<=
operator== overload
operator>
operator>=
operator^
operator|
operator||

Source

Lines 165-233 in include/internal/catch_decomposer.h.

template<typename LhsT>
class ExprLhs {
    LhsT m_lhs;
public:
    explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {}
    template<typename RhsT>
    auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
        return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs };
    }
    auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
        return { m_lhs == rhs, m_lhs, "==", rhs };
    }
    template<typename RhsT>
    auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
        return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs };
    }
    auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
        return { m_lhs != rhs, m_lhs, "!=", rhs };
    }
    template<typename RhsT>
    auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
        return { static_cast<bool>(m_lhs > rhs), m_lhs, ">", rhs };
    }
    template<typename RhsT>
    auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
        return { static_cast<bool>(m_lhs < rhs), m_lhs, "<", rhs };
    }
    template<typename RhsT>
    auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
        return { static_cast<bool>(m_lhs >= rhs), m_lhs, ">=", rhs };
    }
    template<typename RhsT>
    auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
        return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<=", rhs };
    }
    template <typename RhsT>
    auto operator | (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
        return { static_cast<bool>(m_lhs | rhs), m_lhs, "|", rhs };
    }
    template <typename RhsT>
    auto operator & (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
        return { static_cast<bool>(m_lhs & rhs), m_lhs, "&", rhs };
    }
    template <typename RhsT>
    auto operator ^ (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
        return { static_cast<bool>(m_lhs ^ rhs), m_lhs, "^", rhs };
    }
    template<typename RhsT>
    auto operator && ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const {
        static_assert(always_false<RhsT>::value,
        "operator&& is not supported inside assertions, "
        "wrap the expression inside parentheses, or decompose it");
    }
    template<typename RhsT>
    auto operator || ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const {
        static_assert(always_false<RhsT>::value,
        "operator|| is not supported inside assertions, "
        "wrap the expression inside parentheses, or decompose it");
    }
    auto makeUnaryExpr() const -> UnaryExpr<LhsT> {
        return UnaryExpr<LhsT>{ m_lhs };
    }
};





Add Discussion as Guest

Log in