[asio] wrapping handler with tuple in serialization example, client.cpp, connection.hpp

In svn, the serialization example wraps a mem func ptr in a tuple to be tossed through various bind calls. In client.cpp, I found that using boost::protect around the bind call prevents the compile errors but I'm not sure why. connection_.async_read(stocks_, boost::protect(boost::bind(&client::handle_read, this, boost::asio::placeholders::error))); Any ideas as to why this works?

Hi, I was wondering the same thing but Chris explained before http://article.gmane.org/gmane.comp.lib.boost.asio.user/136 Have you replaced the tuples in all handlers and tested the example ? I'd prefer to use boost::protect too but there may be a small performance penalty by having to use boost::function instead of a regular function pointer. It would be good to know whether this performance penalty is negligible or not regards jose On 9/18/07, Chris Fairles <chris.fairles@gmail.com> wrote:
In svn, the serialization example wraps a mem func ptr in a tuple to be tossed through various bind calls.
In client.cpp, I found that using boost::protect around the bind call prevents the compile errors but I'm not sure why.
connection_.async_read(stocks_, boost::protect(boost::bind(&client::handle_read, this, boost::asio::placeholders::error)));
Any ideas as to why this works? _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Chris Fairles
-
Jose