Menu::Menu( map < string, void(*)() > options) :
menuOptions(options)
{}
Menu Option delcaration in the Menu.h: private: // Brief: Map of a string (which describes the option) and the linking function to call map < string, void(*)() > menuOptions;
void Menu::printInvalidEntryErrorMessage() {
cout << INVALID_ENTRY_ERROR_MESSAGE << endl;
}
int Menu::startMenu() {
pair<string, void(*)()> newPair = { "randomString", Menu::printInvalidEntryErrorMessage };
menuOptions.insert(newPair);
}
Getting an error when trying to insert into this map that is member of the Menu Class. The error I get when trying to compile the code is the following:
no instance of constructor "std::pair<_Ty1, _Ty2">::pair [with _Ty1=std::string, _Ty2=void(*)()]" matches the argument list
All I am asking is how do you insert a member function into a map within a class?
Any help would be appreciated. Thank you :)