Reputation: 474
I'd like to use boost::function to pass callback as parameter, like this way:
void ReadPacket(
boost::function<void (const boost::system::error_code&, Packet* p)> callback);
and then use it :
ReadPacket(boost::bind(
&ServerSession::storePacket,
this,
_1,
_2
));
After all after a chain of callbacks i call
callback(ec, packet);
I've just compiled solution in Debug and everything looks OK ...
but in Release I got lots of errors mentioned above
BasicSession.h(30): error C2039: 'function' : is not a member of 'boost'
BasicSession.h(30): error C2061: syntax error : identifier 'function'
BasicSession.h(30): error C2059: syntax error : ')'
BasicSession.h(30): error C2143: syntax error : missing ')' before ';'
I'm confused and dissappointed.
I've found that there're different syntax in boost::function
. For example boost::function0
or boost::function1
. This was made due to VS2010 doesn't support something (I don't know what exactly)
Am I right?
I also need to make this application as portable and cross-platform as possible.
boost 1.47 and VS2010
Upvotes: 2
Views: 3790