This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Function copy constructor

0 votes

I am struggling to use the copy constructor of the class Function.
What is the reason why this is not the way to copy a Function?

Function* other;
... // steps to give value to other
Function* this = new Function(*other);

I get the following error :

Vectors must be of the same length when assigning. Consider using the copy constructor instead.

asked Feb 21, 2016 by str FEniCS User (1,600 points)

You need to post complete code. I can't tell from the post what you've done to other.

...