Rule-of-three for Functions
Functions only carry handles to access the allocated memory that resides on the Primitives. In some sense the memory is owned by the Primitives. Currently destroying functions does not deallocate all of the data that was allocated before.
This requires the implementation of custom destructors. So we should also implement copy-constructors and copy-assignment operators for all functions (https://en.cppreference.com/w/cpp/language/rule_of_three).
Copy constructors are relevant anyway (see #172 - although copy-constructors might not fix all problems related to solvers) and it is often misleading that Functions are not destroyed when leaving scope.
It is not clear to me whether introducing will break stuff - but on the other hand that would be a bad sign anyway.
What is missing?
- methods to remove data from Primitives
- destructors in all Function classes
- copy-constructors in all Function classes
- copy-assignment operators in all Function classes