Cannot assign map to functions in another namespace

Hello, i am trying to create a map i which i can store functions that i will call later in another class, however i get an error when trying to assign anything to the map

The map code:
1
2
3
typedef void (*keyFunc)(void);
std::map<int, keyFunc> funcList;
using namespace EEngine;


This is in another class where i try to add a function to the map
funcList[Escape] = defaultQuitKey; //The 'Escape' is part of an enum

However whenever i try to compile i get this error:
void(*EEngine::Core::)()is not compatible with void(*)()
Now the function i try to add is part of a namespace called EEngine and is part of the class Core, i just don't get why you would not be able to assign things from another namespace to it. Any suggestions as to why i can't do this or how i can work around it?
Last edited on
Hi ,

As the function is a member function, the declaration should be something like this:

typedef void (EEngine::Core::*keyFunc)();

I know, but i want to be able to assign functions from other classes too, is there any way i can do this?
Topic archived. No new replies allowed.