🔒 Locked
function pointer container using Boost Bind
Advertisement
Original Post
I am trying to call the function(consoleSetRenderMode()) once i get a string called "setRenderMode" but i get compilation errors :( #include #include #include #include
You don't need to use boost::bind if your function signature already matches the function type. However, since your function is overloaded, you do need to disambiguate the function overload. Ex:
consoleFuncs["setRenderMode"] = static_cast<void (*)(const parameters &)>(consoleSetRenderMode);
Quote:
void consoleSetRenderMode(const boost::any );
void consoleSetRenderMode(const parameters ¶ms)
Two functions with the same name and different parameters are overloaded functions. Also, you can't assign elements in a map outside of a function like that. One way to deal with that is to move the assignments to inside main.
to make the post look clear and short
can we get back to the problem
What was wrong with SiCrane's original response? That seems like the correct answer to me.
Quote:
Original post by SiCrane Quote:
void consoleSetRenderMode(const boost::any );
void consoleSetRenderMode(const parameters ¶ms)
Two functions with the same name and different parameters are overloaded functions. Also, you can't assign elements in a map outside of a function like that. One way to deal with that is to move the assignments to inside main.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement