Could some one help me how to implement this code?
I need to pass a function to another function:
std::cout << process_time(Model::method1) <<
This is the closest to your code that compiles:
#include
#include
struct Model {
template
double method1(std::vector &v) {
double t = 0;
//...
return t;
}
};
template
double process_time(F algorithm) {
Model model;
double time = 0;
bool stop_criteria = false;
do
{
std::vector arg1;
// ...
time += (model.*algorithm)(arg1);
} while (!stop_criteria);
return time;
}
int main() {
std::cout << process_time(&Model::method1) << std::endl;
}