Function Pointer Assigned To Map Overload Resolution Problem!

This is a discussion on Function Pointer Assigned To Map Overload Resolution Problem! within the C++ Programming forums, part of the General Programming Boards category; OK, guys, I have 2 maps of function pointers, and im trying to populate them, however they are having problems ...

  1. #1
    That Creepy Network Guy DeepBlackMagic's Avatar
    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,691
    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, 11:10 AM
  2. problem with pointer passing to function
    By umeshjaviya in forum C Programming
    Replies: 3
    Last Post: 05-02-2008, 06:44 AM
  3. towers of hanoi problem
    By aik_21 in forum C Programming
    Replies: 1
    Last Post: 10-02-2004, 02: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21