Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::unordered_map<std::string, void*> callbackReg;
- class A
- {
- public:
- void foo(int a)
- {
- //impl
- }
- void foo(int a, int b)
- {
- //impl
- }
- void foo(int a, double d)
- {
- //impl
- }
- };
- template<class Instance , typename Function>
- void register_func(Instance& obj, Function func)
- {
- /* have to store function name as the key and
- - pointer to raw member function pointer as the value,
- - in callbackReg Map */
- // ---> Point B
- }
- int main(int argc, const char * argv[])
- {
- A a;
- register_evt(a, &A::foo); //---> point A
- system("Pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement