class MyObject{
public:
void testFunctionMap(){
std::unordered_map<std::string, std::function<void()> > functionMap;
std::pair<std::string, std::function<void()> > myPair("print", std::bind(&MyObject::printSomeText, this) );
functionMap.insert( myPair );
functionMap["print"]();
}
void printSomeText()
{
std::cout << "Printing some text";
}
};
MyObject o;
o.testFunctionMap();
これはうまくいきます。ペアの値として MyObject::printSomeText 関数を使用する別の方法はありますか?