I get an error trying to declare vector<const double>
.
The C++ Standard forbids containers of const elements because allocator is ill-formed.'
Confirmed here
So let's assume you can change the signature of myFunction to be:
bool myFunction(const vector<double>& input, vector<double>& output)
{
return false;
}
To set:
auto fn = [this](const vector<double>& input, vector<double>& output) {
return myFunction(input, output);
};
Or if you need to save fn off as a member variable:
std::function<bool(const vector<double>&, vector<double>&)> fn =
[this](const vector<double>& input, vector<double>& output) {
return myFunction(input, output);
};
To invoke:
fn(inputVector, outputVector);