In my class, I try to take a pointer to a method. In my case there are some methods with similar signatures. They are public methods.
The pointer is called Metric.
The compiler reports errors on a marked line:
D:\Job\Acronis\TestProblem\EmulationOfDisk\Emulate\CTesting.cpp:5: ошибка: cannot convert 'std::vector (CTesting::)()' to 'std::vector ()()' in assignment this->Metric = &this->ExTimeofWork;
I think it is a problem with the namespace. I tried to point to "CTesting::" near with a calling method. I could not fix this bug.
If I do the same construction out of class, it works.
Please, can you explain, why does this bug arise? How do I fix it?
class CTesting
{
private:
//code
vector<double> ( *Metric)();
public:
vector<double> ExTimeofWork();
vector<double> ExTimeGenerationToAccept();
vector<double> ExTimePoolToAccept();
vector<double> ExMaxTimeGenerationToAccept();
vector<double> ExMaxTimePoolToAccept();
vector<double> GetTimeGenerationToAccept();
vector<double> GetTimePoolToAccept();
vector<double> GetTimeofWork();
};
void CTesting::Execute()
{
this->Metric = &this->ExTimeofWork;//Ошибка!!!!!!!!!!!!!!!!!!!!
//... Code
//...
return;
}