A wrapper class for scalar types to facilitate reference passing in Python bindings. More...
#include <ikarus/python/finiteelements/scalarwrapper.hh>
Public Types | |
using | RawScalarType = Dune::ResolveRef_t< T > |
Public Member Functions | |
ScalarWrapper (T val) | |
Constructs a ScalarWrapper with the given value. More... | |
operator RawScalarType & () const | |
Implicitly converts the wrapper to a reference of the raw scalar type. More... | |
const RawScalarType & | value () const |
Gets the wrapped scalar value as a constant reference. More... | |
RawScalarType & | value () |
Gets the wrapped scalar value as a reference. More... | |
RawScalarType | operator+ (const ScalarWrapper &v) const |
Adds the values of two ScalarWrapper instances. This returns the raw type since this makes makes no since when T is of reference_wrapper type. More... | |
RawScalarType | operator- (const ScalarWrapper &v) const |
Subtracts the value of another ScalarWrapper from this instance. More... | |
RawScalarType | operator- () const |
Negates the wrapped scalar value. More... | |
RawScalarType | operator* (RawScalarType value) const |
Multiplies the wrapped scalar value by another value. More... | |
ScalarWrapper & | operator+= (const ScalarWrapper &v) |
Adds another ScalarWrapper's value to this instance. More... | |
ScalarWrapper & | operator-= (const ScalarWrapper &v) |
Subtracts another ScalarWrapper's value from this instance. More... | |
ScalarWrapper & | operator*= (RawScalarType v) |
Multiplies the wrapped scalar value by another value and assigns the result. More... | |
ScalarWrapper & | operator/= (RawScalarType v) |
Divides the wrapped scalar value by another value and assigns the result. More... | |
This class resolves the limitations involving reference arguments in Python, enabling seamless integration with C++ functions expecting reference types.
T | The type of the scalar to be wrapped. |
using ScalarWrapper< T >::RawScalarType = Dune::ResolveRef_t<T> |
|
inline |
val | The initial value of the wrapped scalar. |
|
inline |
|
inline |
value | The value to multiply with. |
|
inline |
v | The value to multiply with. |
|
inline |
v | Another ScalarWrapper instance. |
|
inline |
v | Another ScalarWrapper instance. |
|
inline |
|
inline |
v | Another ScalarWrapper instance. |
|
inline |
v | Another ScalarWrapper instance. |
|
inline |
v | The value to divide by. |
|
inline |
|
inline |