I have code as foolows
template <typename T, typename P>
Nats::MessageCallback registerNatsCallback(P* p)
{
using std::placeholders::_1;
using std::placeholders::_2;
using std::placeholders::_3;
return std::bind(T, p, _1, _2, _3);
}
I want to use this i this way:
nc.subscribe("Test_1", registerNatsCallback<&App::natsHandler1>(this));
Unfortenly i ended up with compiler error (gcc)
In file included from ..\NATS_CLIENT\main.cpp:2:0:
..\NATS_CLIENT\app.h: In member function 'Nats::MessageCallback
App::registerNatsCallback(P*)':
..\NATS_CLIENT\app.h:28:27: error: expected primary-expression before ',' token
return std::bind(T, p, _1, _2, _3);
I think that this error has connection with this link, but I didn't see how I can apply 'template' in my situation. I don't have to much experience in templates...