https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
CompileTimeDerivatives::CTBinary< L, R > Class Template Reference

Base class for a binary operator/function. More...

#include <CompileTimeDerivatives.h>

Inheritance diagram for CompileTimeDerivatives::CTBinary< L, R >:
[legend]

Public Types

typedef libMesh::CompareTypes< typenameL::ResultType, typenameR::ResultType >::supertype ResultType
 

Public Member Functions

 CTBinary (L left, R right)
 
template<typename Self >
std::string printParens (const Self *, const std::string &op) const
 

Static Public Member Functions

static constexpr int precedence ()
 precedence should reflect C++ operator precedence exactly (higher is binding tighter)
 
static constexpr bool leftAssociative ()
 left/right associative property should reflect C++ operator properties exactly
 

Protected Attributes

const L _left
 
const R _right
 

Detailed Description

template<typename L, typename R>
class CompileTimeDerivatives::CTBinary< L, R >

Base class for a binary operator/function.

Definition at line 192 of file CompileTimeDerivatives.h.

Member Typedef Documentation

◆ ResultType

template<typename L , typename R >
typedef libMesh::CompareTypes<typenameL::ResultType,typenameR::ResultType>::supertype CompileTimeDerivatives::CTBinary< L, R >::ResultType

Definition at line 198 of file CompileTimeDerivatives.h.

Constructor & Destructor Documentation

◆ CTBinary()

template<typename L , typename R >
CompileTimeDerivatives::CTBinary< L, R >::CTBinary ( left,
right 
)
inline

Member Function Documentation

◆ leftAssociative()

static constexpr bool CompileTimeDerivatives::CTBase::leftAssociative ( )
inlinestaticconstexprinherited

left/right associative property should reflect C++ operator properties exactly

Definition at line 31 of file CompileTimeDerivatives.h.

31{ return false; }

◆ precedence()

static constexpr int CompileTimeDerivatives::CTBase::precedence ( )
inlinestaticconstexprinherited

precedence should reflect C++ operator precedence exactly (higher is binding tighter)

Definition at line 29 of file CompileTimeDerivatives.h.

29{ return 0; }

◆ printParens()

template<typename L , typename R >
template<typename Self >
std::string CompileTimeDerivatives::CTBinary< L, R >::printParens ( const Self *  ,
const std::string &  op 
) const
inline

Definition at line 201 of file CompileTimeDerivatives.h.

202 {
203 std::string out;
204 if constexpr (L::precedence() > Self::precedence())
205 out = "(" + _left.print() + ")";
206 else
207 out = _left.print();
208
209 out += op;
210
211 if (R::precedence() > Self::precedence() ||
212 (R::precedence() == Self::precedence() && Self::leftAssociative()))
213 out += "(" + _right.print() + ")";
214 else
215 out += _right.print();
216
217 return out;
218 }
OStreamProxy out(std::cout)

Referenced by CompileTimeDerivatives::CTAdd< L, R >::print(), CompileTimeDerivatives::CTSub< L, R >::print(), CompileTimeDerivatives::CTMul< L, R >::print(), CompileTimeDerivatives::CTDiv< L, R >::print(), and CompileTimeDerivatives::CTCompare< C, L, R >::print().

Member Data Documentation

◆ _left

template<typename L , typename R >
const L CompileTimeDerivatives::CTBinary< L, R >::_left
protected

◆ _right

template<typename L , typename R >
const R CompileTimeDerivatives::CTBinary< L, R >::_right
protected

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