文件:Service.hpp
class Service
{
private:
boost::unordered_map<std::string,int> m_mapModuleType2FD;
void ProcessRequest();
public:
static void* KeepAlive(void* arg);
};
文件:Service.cpp:
在功能处理请求中,我更新了地图
void Service::ProcessRequest()
{
m_mapModuleType2FD["ak"] = 1;
LaunchKeepAlive();
}
void Service::LaunchKeepAlive()
{
pthread_create( & m_ptKeepAliveThreadID, NULL, Service::KeepAlive, NULL );
}
现在在 KeepAlive 我试图寻找更新的值
void * Service::KeepAlive(void* arg)
{
boost::unordered_map<std::string,int>::iterator itrDummy;
itrDummy = m_mapModuleType2FD.find("AK"); --- Line 420
}
我在哪里得到错误
错误:第 420 行 .invalid use of member 'Service::m_mapModuleType2FD' in static member function
我对 C++ 有点陌生 ..所以任何输入都会受到高度赞赏