KASSERT  0.0.1
Karlsruhe Assertion Library
kassert::internal::BinaryExpression< LhsT, RhsT > Class Template Reference

A decomposed binary expression. More...

#include <expression_decomposition.hpp>

Inheritance diagram for kassert::internal::BinaryExpression< LhsT, RhsT >:
kassert::internal::Expression

Public Member Functions

 BinaryExpression (bool const result, LhsT const &lhs, std::string_view const op, RhsT const &rhs)
 Constructs a decomposed binary expression. More...
 
bool result () const final
 The boolean result of the expression. This is used when retrieving the expression result after decomposition. More...
 
 operator bool ()
 Implicitly cast to bool. This is used when encountering && or ||. More...
 
void stringify (OStreamLogger &out) const final
 Writes this expression with stringified operands to the given assertion logger. More...
 
- Public Member Functions inherited from kassert::internal::Expression
virtual ~Expression ()=default
 Virtual destructor since we use virtual functions.
 
virtual bool result () const =0
 Evaluate the assertion wrapped in this Expr. More...
 
virtual void stringify (OStreamLogger &out) const =0
 Write this expression with stringified operands to the given assertion logger. More...
 

Detailed Description

template<typename LhsT, typename RhsT>
class kassert::internal::BinaryExpression< LhsT, RhsT >

A decomposed binary expression.

Template Parameters
LhsTDecomposed type of the left hand side of the expression.
RhsTDecomposed type of the right hand side of the expression.

Constructor & Destructor Documentation

◆ BinaryExpression()

template<typename LhsT , typename RhsT >
kassert::internal::BinaryExpression< LhsT, RhsT >::BinaryExpression ( bool const  result,
LhsT const &  lhs,
std::string_view const  op,
RhsT const &  rhs 
)
inline

Constructs a decomposed binary expression.

Parameters
resultBoolean result of the expression.
lhsDecomposed left hand side of the expression.
opStringified operator or relation.
rhsDecomposed right hand side of the expression.

Member Function Documentation

◆ operator bool()

template<typename LhsT , typename RhsT >
kassert::internal::BinaryExpression< LhsT, RhsT >::operator bool ( )
inline

Implicitly cast to bool. This is used when encountering && or ||.

Returns
The boolean result of the expression.

◆ result()

template<typename LhsT , typename RhsT >
bool kassert::internal::BinaryExpression< LhsT, RhsT >::result ( ) const
inlinefinalvirtual

The boolean result of the expression. This is used when retrieving the expression result after decomposition.

Returns
The boolean result of the expression.

Implements kassert::internal::Expression.

◆ stringify()

template<typename LhsT , typename RhsT >
void kassert::internal::BinaryExpression< LhsT, RhsT >::stringify ( OStreamLogger out) const
inlinefinalvirtual

Writes this expression with stringified operands to the given assertion logger.

Parameters
outThe assertion logger.

Implements kassert::internal::Expression.


The documentation for this class was generated from the following file: