Commit fd6c9be8 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[master] use a wrapper for boost::function to work around sunstudio build issue

it can't handle it if we pass a function object directly to asio function
(also templated).  okayed on jabber.
parent fc4e4e5c
......@@ -158,9 +158,22 @@ private:
asio::error_code ec_;
// The callback functor for internal asynchronous read event. This is
// stateless (and it will be copied in the ASIO library anyway), so
// can be const
const boost::function<void(const asio::error_code&, size_t)>
recv_callback_;
// can be const.
// SunStudio doesn't like a boost::function object to be passed, so
// we use the wrapper class as a workaround.
class CallbackWrapper {
public:
CallbackWrapper(boost::function<void(const asio::error_code&, size_t)>
callback) :
callback_(callback)
{}
void operator()(const asio::error_code& error, size_t len) {
callback_(error, len);
}
private:
boost::function<void(const asio::error_code&, size_t)> callback_;
};
const CallbackWrapper recv_callback_;
// Auxiliary functions
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment