const is a some what overrated concept that leads to more typing
and maintenance.
In your case myfunc is not const as it alters a member variable
if this is not appropriate to be altered then you need to use a local
double myfunc(double x1,double x2, double x3) const
{
std::vector<double> memory(4, 0.0);
//etc...
}
but your function does not necessarily want this either...
the const is telling the compiler that you are not altering the class
but that is what you are doing and there is no way that the compiler can resolve this problem.
There might be a way to cast the function to const but I don't know it...
the question is why does the other end need to know that your class variable is const....
it should not matter it is only that x1, x2, x3
are not changing that should matter where the function is called! so there is no logical need for the function to be declared const only the inputs!