Copy constructors in non-leaf classes
As discussed with Nikola yesterday: The classes inheriting from Cloneable
need to explicitly make their copy constructors protected
or = delete
, as otherwise the compiler will implicitly generate a public
copy constructor. This should be added everywhere necessary and commented appropriately (even in current leaf classes, in case someone derives from them at a later point).
The same is true with copy assignment, however that can be taken care of by = delete
ing it in Cloneable
. That should be ok, since we will (usually) never want to copy assign polymorphic classes anyway.
There is a special case for LinearOperator
: it currently exposes public
copy construction and assignment, which is required for the composite operator functionality to work, but is hugely problematic otherwise (it can result in slicing when, e.g. assigning a Scaling
operator to a LinearOperator
). I currently have no good idea how to solve this (and keep the value semantics of composite LinearOperator
s at the same time), excepting trying to restrict their usage somehow through clever protected
and friend
manipulations.