CoDiPack  3.0.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::ExpressionMemberOperations< T_Real, T_Impl, typename > Struct Template Reference

#include <expressionMemberOperations.hpp>

Inheritance diagram for codi::ExpressionMemberOperations< T_Real, T_Impl, typename >:

Public Types

using Impl = T_Impl
 See ExpressionMemberOperations.
 
using Real = T_Real
 See ExpressionMemberOperations.
 

Protected Member Functions

inlineImpl const & cast () const
 Cast to implementation.
 

Detailed Description

template<typename T_Real, typename T_Impl, typename = void>
struct codi::ExpressionMemberOperations< T_Real, T_Impl, typename >

Interface for injecting member operations in expressions

The ExpressionInterface extends from this interface and therefore all methods defined in specializations of this class are available in expressions with the specialized Real type.

E.g. the complex type has the member operations real() and imag(). Which makes the following code possible.

std::complex<double> a,b;
double z = (a + b).real();
inlineauto real(ExpressionInterface< std::complex< Real >, Arg > const &arg)
Function overload for FUNCTION.
Definition allOperators.hpp:75

In an expression framework, the member operator could be implemented in the AggregatedActiveType specialization for std::complex but this will not make the member operator available in the expression (a+b). The compiler would throw an error that the member operator real() is not available in a BinaryExpression.

By the specialization of this class, member methods can be injected into arbitrary expression implementations. This includes e.g. ActiveType, AggregatedActiveType, BinaryExpression, etc. In the complex case the specialization can be viewed in stdComplex.hpp.

Template Parameters
T_RealOriginal primal value of the statement/expression.
T_ImplClass implementing this interface.

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