Thread: Function Pointer Assigned To Map Overload Resolution Problem!

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    265

    Function Pointer Assigned To Map Overload Resolution Problem!

    OK, guys, I have 2 maps of function pointers, and im trying to populate them, however they are having problems deciding which function to use. Im looking for a way to resolve it.

    Code:
    ...
    
    //2 unique maps of strings and function pointers
    std::map<std::string, void (*)(std::string,Object1*)> func_map1;
    std::map<std::string, void (*)(std::string,Object2*)> func_map2;
    
    ...
    
    //2 clearly unique overloaded functions
    myfunc1(std::string input, Object1* moreinput) { ...blah... }
    myfunc1(std::string input, Object2* moreinput) { ...blah... }
    
    ...
    
    //2 assignment statements that should return
    // different overloads of myfunc1
    func_map1["myfunc1"]=*myfunc1;
    func_map2["myfunc1"]=*myfunc1;
    
    ...
    Im looking for something i can do to the lines like func_map1["myfunc1"]=*myfunc1; to help the compiler resolve the error im getting: "error C2244: 'myfunc1' : unable to resolve function overload".

    Thanks for your time!

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Code:
    func_map1["myfunc1"] = &myfunc1;
    func_map2["myfunc1"] = &myfunc1;
    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Following CTools
    By EstateMatt in forum C Programming
    Replies: 5
    Last Post: 06-26-2008, 10:10 AM
  2. problem with pointer passing to function
    By umeshjaviya in forum C Programming
    Replies: 3
    Last Post: 05-02-2008, 05:44 AM
  3. towers of hanoi problem
    By aik_21 in forum C Programming
    Replies: 1
    Last Post: 10-02-2004, 01:34 PM
  4. problem about static Lib and function pointer
    By wu7up in forum C Programming
    Replies: 3
    Last Post: 02-24-2003, 09:34 AM
  5. Replies: 5
    Last Post: 02-08-2003, 07:42 PM