Skip to content

[forms] Add mixin class for inheriting properties of a MultilinearOperator

Carsten Gräser requested to merge feature/forms-avoid-operator-inheritance into master

This class allows to inherit the arity-dependent properties of some given base operator. To this end the derived class has to implement a baseOperator() method. To avoid 'incomplete type' issues, the returned BaseOperator type has to be passed explicitly to the mixin and cannot be derived from the derived class.

Alternatively the derived class could inherit from BaseOperator instead of storing one as a member, but this may lead to false matching of overloads that silently cast the derived class to this base class. This approach was used in ProductWithNullaryOperator and TransformedOperator which hence suffered from the above issue. (Notice that inheritance should model an 'is a' relation, while here we only want certain properties.) These classes now use the new mixin class.

Edited by Carsten Gräser

Merge request reports

Loading