I am trying to hash a string to a pointer to a void function which takes in a string. I get the following error when trying to insert my key value pair into the map:
"No matching member function for call to "insert"
I am not sure how to interpret this error.
I think I'm either passing in the wrong type for insert, the function reference incorrectly, or typedef'ing a function pointer wrong.
#include <string> #include <unordered_map> using namespace std; void some_function(string arg) { //some code } int main(int argc, const char * argv[]) { typedef void (*SwitchFunction)(string); unordered_map<string, SwitchFunction> switch_map; //trouble with this line switch_map.insert("example arg", &some_function); } Any advice would be appreciated.