If I had a base class MessageWrapper, with a child class SetConfigurationData, why does binding with a child class parameter not work?
Shouldn't it work polymorphically?
Class MessageHandler
{
public:
void RegisterHandler(std::function<void(MessageWrapper &)> callback_)
{}
};
class Testing
{
public:
Testing(MessageHandler &handler_)
: m_Handler(handler_)
{
m_Handler.RegisterHandler(std::bind(&Testing::TestMessageHandler, this, std::placeholders::_1));
}
void TestMessageHandler(SetConfigurationData &msg_)
{}
MessageHandler m_Handler;
};
I get the error: "Failed to specialize function template 'unkown-type std::invoke(Callable &&, Types &&..)'
It works if I do this:
void TestMessageHandler(MessageWrapper &msg_)
{}